-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
DEV backlog
In assign we retrieve the content unfiltered when editing, and in MOBILE-4482 we fixed it when editing forum posts too. But there are other places of the app that still use filtered content when editing, like in glossary.
We should review all the places of the app that allow editing content (glossary, wiki, blog, etc.) to see which ones have the issue, and if it can be solved easily.
The main problem about this is that, if the app edits the content already filtered, then it will save it in DB already filtered too, but that's wrong: the content stored in DB should not be filtered, the filters should be applied on top of unfiltered content. This can also cause problems with embedded images, because the app will save them using the endpoints webservice/pluginfile or tokenpluginfile, and that can cause problems.
In forum it was easy to fix it because the WS mod_forum_prepare_draft_area_for_post already returns the content unfiltered, and the user can only edit a post in online. But in glossary for example we don't have a WebService for that, we'd need to call the mod_glossary_get_entry_by_id WebService using filter=false and rewriteurls=false (similar to what we do in assign).
The main problem will be in places that allow editing in offline, because that would mean we need to store the content twice: filtered and unfiltered. In assign we don't allow editing text in offline, and we don't allow edit offline either in forum and glossary.
EDIT:
Another problem we found is when using filters in titles/subjects. E.g. if you put MathJax in a forum post subject and then you edit it in the app, the app sets the HTML in the subject field and trying to save it throws an error because Moodle doesn't allow HTML in there.