Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-4647

App edits content already filtered in some areas like glossary

    • Hide

      This issue only needs to be tested in 1 device.

      Things to take into account

      • Each section will specify if the feature requires to be online or not to edit the content. In this issue's comments you will find the decisions taken about this.
      • In general, the places that require connection to edit means that the user needs to be online at the moment to open the edit page, but then he can go offline and save changes while offline. The only exception is glossary, in glossary you also need to be online when saving the data. This already worked like this and I didn't change it because it's out of the scope of this issue.
      • I only fixed the part about adding filters/images in the rich text editor, I didn't fix the problem with some fields like the forum post title. I opened MOBILE-4778 for that.

      Common steps

      To test that filters work properly you need to do the following steps that are common to most cases. In each section I will specify the specifics to take into account when doing these steps.

      1. In browser, edit the area affected (e.g. a glossary entry) and put:
        1. Some content that will be filtered, I used MathJax like (a \ne 0) or $$ax^2 + bx + c = 0$$.
        2. An image uploaded to Moodle using the Moodle's file picker. Please notice that some areas don't allow uploading an image to Moodle, only allow you to include an external image using a URL, in that case you don't need to include an image. E.g. this happens in workshop feedback.
      2. In the app, when editing the content you should view the image in the editor (it's not a broken image). To test that the MathJax is being edited properly, you should click to view the source code in the editor and check the content does NOT include: <span class="filter_mathjaxloader_equation">.
      3. If saving offline is allowed, save the content in offline and check that the image is viewed properly (if the content allows adding images). Please notice that MathJax won't be seen properly in this case because the content is unfiltered.
      4. If you have offline content, synchronize it and check that the data is properly saved:
        1. Images still work and MathJax is now seen.
        2. When adding images is allowed in the area, edit the content in browser and check that the URL of the image in the editor uses the URL draftfile.php.
      5. In the app, edit the content online, save changes online and check that the data is properly saved like in the previous step.

      Test edit blog entry

      Please put the filters and image only in the "Blog entry body" field, not in other fields like the 'Entry title'.

      You need to be online when opening the page to edit a blog entry, but after that you can go offline and save the data in offline. So you can test all steps of the "Common steps" section.

      Test edit calendar entry

      Please put the filters in the "Description" field. There is a bug in the WebService (MDL-84754) and images won't work properly in this case, so please test only filters in this case.

      You need to be online when opening the page to edit a calendar entry, but after that you can go offline and save the data in offline. So you can test all steps of the "Common steps" section.

      Test assignment feedback comment (teacher)

      To test this, in the assignment settings you need to enable Feedback types > Feedback comments. Please put the filters and image in the Feedback comments field.

      You need to be online when opening the modal to edit the feedback, but after that you can go offline and save the data in offline. So you can test all steps of the "Common steps" section.

      As an extra step, create an assignment without Feedback comments enabled and check that in this case you can open the edit feedback modal while you're offline (you don't need to test that you can grade offline and all that, just that you can open the modal).

      Test glossary

      Please put the filters and image in the Definition field.

      You need to be online to edit an entry. Both to open the edit page and also to save changes, so in this case you don't need to test the offline part (steps 3 & 4).

      Test workshop as a student

      You will need 2 workshops to test this: one of them should be on the Submission phase and the other in the Assessment phase. For the assessment phase, make sure that the student you will use has at least 1 submission allocated.

      Please put the filters and image in the "Submission content" (for submission) and in the "Feedback for the author" (for assessment) fields. Feedback for the author does not allow adding images, so please test only filters in that case.

      In both cases you can open the edit form in offline if you have downloaded the data. So please prefetch the activity and go offline before opening it to test that you can edit it while offline properly.

      Test workshop as a teacher

      You will need 1 workshop to test this, and it should be in the Grading evaluation phase. The workshop should have at least 1 submission and 1 assessment done by students.

      The fields to test the filters (images are not allowed are so please test only filters) are:

      1. Submission feedback: in the app, when opening the workshop as teacher, click the submission under "Workshop grades report" and at the bottom you will see "Feedback for the author". 
      2. Assessment feedback: in the app, when viewing a submission (previous step), click an assessment under "Grades received" or "Grades given" and at the bottom you will see "Feedback for the reviewer".

      You need to be online when opening the modal to edit both feedbacks, but after that you can go offline and save the data in offline. So you can test all steps of the "Common steps" section. Please notice that, since we're mixing the feedback form with other information like the submission or assessment content, in this case if you open the page while offline you will see a warning saying that the content is not available in offline instead of the feedback form.

       

      Show
      This issue only needs to be tested in 1 device. Things to take into account Each section will specify if the feature requires to be online or not to edit the content. In this issue's comments you will find the decisions taken about this. In general, the places that require connection to edit means that the user needs to be online at the moment to open the edit page, but then he can go offline and save changes while offline. The only exception is glossary, in glossary you also need to be online when saving the data. This already worked like this and I didn't change it because it's out of the scope of this issue. I only fixed the part about adding filters/images in the rich text editor, I didn't fix the problem with some fields like the forum post title. I opened MOBILE-4778 for that. Common steps To test that filters work properly you need to do the following steps that are common to most cases. In each section I will specify the specifics to take into account when doing these steps. In browser, edit the area affected (e.g. a glossary entry) and put: Some content that will be filtered, I used MathJax like (a \ne 0) or $$ax^2 + bx + c = 0$$. An image uploaded to Moodle using the Moodle's file picker . Please notice that some areas don't allow uploading an image to Moodle, only allow you to include an external image using a URL, in that case you don't need to include an image. E.g. this happens in workshop feedback. In the app, when editing the content you should view the image in the editor (it's not a broken image). To test that the MathJax is being edited properly, you should click to view the source code in the editor and check the content does NOT include: <span class="filter_mathjaxloader_equation">. If saving offline is allowed, save the content in offline and check that the image is viewed properly (if the content allows adding images). Please notice that MathJax won't be seen properly in this case because the content is unfiltered. If you have offline content, synchronize it and check that the data is properly saved: Images still work and MathJax is now seen. When adding images is allowed in the area, edit the content in browser and check that the URL of the image in the editor uses the URL draftfile.php. In the app, edit the content online, save changes online and check that the data is properly saved like in the previous step. Test edit blog entry Please put the filters and image only in the "Blog entry body" field, not in other fields like the 'Entry title'. You need to be online when opening the page to edit a blog entry, but after that you can go offline and save the data in offline. So you can test all steps of the "Common steps" section. Test edit calendar entry Please put the filters in the "Description" field. There is a bug in the WebService ( MDL-84754 ) and images won't work properly in this case, so please test only filters in this case. You need to be online when opening the page to edit a calendar entry, but after that you can go offline and save the data in offline. So you can test all steps of the "Common steps" section. Test assignment feedback comment (teacher) To test this, in the assignment settings you need to enable Feedback types > Feedback comments. Please put the filters and image in the Feedback comments field. You need to be online when opening the modal to edit the feedback, but after that you can go offline and save the data in offline. So you can test all steps of the "Common steps" section. As an extra step, create an assignment without Feedback comments enabled and check that in this case you can open the edit feedback modal while you're offline (you don't need to test that you can grade offline and all that, just that you can open the modal). Test glossary Please put the filters and image in the Definition field. You need to be online to edit an entry. Both to open the edit page and also to save changes, so in this case you don't need to test the offline part (steps 3 & 4). Test workshop as a student You will need 2 workshops to test this: one of them should be on the Submission phase and the other in the Assessment phase. For the assessment phase, make sure that the student you will use has at least 1 submission allocated. Please put the filters and image in the "Submission content" (for submission) and in the "Feedback for the author" (for assessment) fields. Feedback for the author does not allow adding images, so please test only filters in that case. In both cases you can open the edit form in offline if you have downloaded the data. So please prefetch the activity and go offline before opening it to test that you can edit it while offline properly. Test workshop as a teacher You will need 1 workshop to test this, and it should be in the Grading evaluation phase. The workshop should have at least 1 submission and 1 assessment done by students. The fields to test the filters (images are not allowed are so please test only filters) are: Submission feedback: in the app, when opening the workshop as teacher, click the submission under "Workshop grades report" and at the bottom you will see "Feedback for the author".  Assessment feedback: in the app, when viewing a submission (previous step), click an assessment under "Grades received" or "Grades given" and at the bottom you will see "Feedback for the reviewer". You need to be online when opening the modal to edit both feedbacks, but after that you can go offline and save the data in offline. So you can test all steps of the "Common steps" section. Please notice that, since we're mixing the feedback form with other information like the submission or assessment content, in this case if you open the page while offline you will see a warning saying that the content is not available in offline instead of the feedback form.  
    • Moodle Apps Sprint 2025-I1.4

      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.

      ------

      We use the rich text editor in the following places of the app to edit content. Some of them work fine and some others don't, so I've classified them:

      App handles filters properly

      Edit an assign submission (student) 
      Edit a forum post
      Edit a wiki page
      Answer a quiz essay

      App edits content already filtered (wrong behaviour)

      Edit a blog entry
      Edit a calendar event
      Edit an assign feedback comment (teacher)
      Edit a glossary entry
      Edit a workshop submission
      Edit a workshop assessment as student
      Edit a workshop submission's feedback in grading evaluation phase as teacher
      Edit a workshop assessment's feedback in grading evaluation phase as teacher
      Create a new user with a textarea profile field that has a default value containing filters

      App doesn't display filters properly (we receive content unfiltered)
      Database entries

            dpalou Dani Palou
            dpalou Dani Palou
            Pau Ferrer Pau Ferrer
            Isabel Renedo Rouco Isabel Renedo Rouco
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 11 minutes
                1d 11m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.