Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-65275

Forum code is calling format_text twice on the forum post content

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.7
    • Fix Version/s: 3.7
    • Component/s: Forum
    • Labels:
    • Testing Instructions:
      Hide
      1. Run the following two commands in your wwwroot

        git clone https://github.com/moodleou/moodle-filter_embedquestion.git filter/embedquestion/
        git clone https://github.com/moodleou/moodle-atto_embedquestion.git lib/editor/atto/plugins/embedquestion/
        

      2. Upgrade your site and save default values.
      3. Visit 'Site administration' > 'Plugins' > 'Filters' > 'Manage filters'.
      4. Enable 'Embed questions' for 'Content and headings'.
      5. Go to 'Site administration' > 'Plugins' > 'Text editors' > 'Atto HTML editor' > 'Atto toolbar settings' and in the Toolbar config field, find the line that starts 'insert =', and add 'embedquestion' to the list.
      6. Visit a course.
      7. Click on the cog in the top-right.
      8. Click on 'More...'.
      9. Click on 'Question bank'.
      10. Click on 'Categories' tab.
      11. Create a category called "Test questions [ID:embed]" to the "Default for XYZ" category (where XYZ is the course name).
      12. Click on the 'Questions' tab.
      13. Click on 'Create a new question ...'.
      14. Create a 'True/false' question with the name 'Test questions [ID:embed]' and add it to the Category you created earlier.
      15. Go back to the course.
      16. Create a forum.
      17. Add a new discussion topic.
      18. In the atto editor expand all the options.
      19. Click on the 'Embed question' icon (it has 2 ticks and a dot in a list - hovering over the icons displays their name).
      20. Add the question to the forum post.
      21. Click 'Save changes'
      22. View the forum discussion and confirm you can see the quiz question.
      Show
      Run the following two commands in your wwwroot git clone https://github.com/moodleou/moodle-filter_embedquestion.git filter/embedquestion/ git clone https://github.com/moodleou/moodle-atto_embedquestion.git lib/editor/atto/plugins/embedquestion/ Upgrade your site and save default values. Visit 'Site administration' > 'Plugins' > 'Filters' > 'Manage filters'. Enable 'Embed questions' for 'Content and headings'. Go to 'Site administration' > 'Plugins' > 'Text editors' > 'Atto HTML editor' > 'Atto toolbar settings' and in the Toolbar config field, find the line that starts 'insert =', and add 'embedquestion' to the list. Visit a course. Click on the cog in the top-right. Click on 'More...'. Click on 'Question bank'. Click on 'Categories' tab. Create a category called "Test questions [ID:embed] " to the "Default for XYZ" category (where XYZ is the course name). Click on the 'Questions' tab. Click on 'Create a new question ...'. Create a 'True/false' question with the name 'Test questions [ID:embed] ' and add it to the Category you created earlier. Go back to the course. Create a forum. Add a new discussion topic. In the atto editor expand all the options. Click on the 'Embed question' icon (it has 2 ticks and a dot in a list - hovering over the icons displays their name). Add the question to the forum post. Click 'Save changes' View the forum discussion and confirm you can see the quiz question.
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-65275_master

      Description

      Since recent change, mod_forum is calling format_text twice on the post body. This is just wrong, and breaks filters like filter_embedquestion.

      The stack traces for the two places the filter is called from are:

      • line 425 of /mod/forum/classes/local/exporters/post.php: call to format_text()
      • line 308 of /mod/forum/classes/local/exporters/post.php: call to mod_forum\local\exporters\post->get_message()
      • line 125 of /lib/classes/external/exporter.php: call to mod_forum\local\exporters\post->get_other_values()
      • line 137 of /mod/forum/classes/local/exporters/posts.php: call to core\external\exporter->export()
      • line ? of unknownfile: call to mod_forum\local\exporters\posts->mod_forum\local\exporters{closure}()
      • line 139 of /mod/forum/classes/local/exporters/posts.php: call to array_map()
      • line 125 of /lib/classes/external/exporter.php: call to mod_forum\local\exporters\posts->get_other_values()
      • line 168 of /mod/forum/classes/local/builders/exported_posts.php: call to core\external\exporter->export()
      • line 98 of /mod/forum/classes/local/renderers/posts.php: call to mod_forum\local\builders\exported_posts->build()
      • line 180 of /mod/forum/classes/local/renderers/discussion.php: call to mod_forum\local\renderers\posts->render()
      • line 315 of /mod/forum/discuss.php: call to mod_forum\local\renderers\discussion->render()
      • line 1018 of /lib/externallib.php: call to format_text()
      • line 161 of /lib/classes/external/exporter.php: call to external_format_text()
      • line 137 of /mod/forum/classes/local/exporters/posts.php: call to core\external\exporter->export()
      • line ? of unknownfile: call to mod_forum\local\exporters\posts->mod_forum\local\exporters{closure}()
      • line 139 of /mod/forum/classes/local/exporters/posts.php: call to array_map()
      • line 125 of /lib/classes/external/exporter.php: call to mod_forum\local\exporters\posts->get_other_values()
      • line 168 of /mod/forum/classes/local/builders/exported_posts.php: call to core\external\exporter->export()
      • line 98 of /mod/forum/classes/local/renderers/posts.php: call to mod_forum\local\builders\exported_posts->build()
      • line 180 of /mod/forum/classes/local/renderers/discussion.php: call to mod_forum\local\renderers\posts->render()
      • line 315 of /mod/forum/discuss.php: call to mod_forum\local\renderers\discussion->render()

        Attachments

          Activity

            People

            Assignee:
            markn Mark Nelson
            Reporter:
            timhunt Tim Hunt
            Peer reviewer:
            Ryan Wyllie
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Gladys Basiana
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              20/May/19

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 40 minutes
                3h 40m