Group Forum Topic Edit/Delete Broken!
|Reported by:||edfactor||Owned by:|
In Group Discussions (forums), there is a serious problem that only appears to be a minor problem:
Topics (entities that start discussions) and Posts (which are annotations to discussions) are different things. Also, the initial text of a topic is an annotation of the topic, which is different than the Post annotations.
Here is what goes wrong:
- You create a topic
- You decide to alter it
- You hit the delete button. You get a message saying the "post" is deleted - but it wasn't a post!
- You see that the topic title is there. You go to discussions and see it's gone, but... it's still in the river, and if you tagged that post, it will come up when you search by tag.
- If you chose edit, that also doesn't work. You can only edit the text of the topic, and not the title or tags.
So what explains this behavior?
The Edit/Delete links on the Topic don't work because they lead to the edit and delete functions for posts. But the posts are annotations and not entities (like topics). You can edit the text because the system says, "change the text for the annotation with this ID" using the post functionality. It then calls an update on the annotation of the topic (which isn't a post) but the update works as it doesn't check to see if it's a post you're updating.
So what's the solution to all this?
- You need a new "view" ( a file ) for topic that isn't the view for the post, and those edit/delete links need to result in editing and deleting the topic. (attaching this file, needs to go in /mod/groups/views/default/forum)
- You need a change to the viewposts.php file to direct you to that correct view. (patch included for that and nice divs for striping)
I realize this is a lot of text for this report, but my wife Maureen found this and put a lot of effort into fixing the problem. (I have the Trac account, so I filed it)
I have tested this, and it works. Also, when you add these fixes, you must either hit upgrade.php or do something to clear the view cache as you have a new file (topic.php) that Elgg doesn't know about.