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

Add courseId and forumId info to mod_forum_get_discussion_posts WS

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a Token in the mobile app service for one user enrolled in the course (and not the admin):
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Create a new course
      4. Create a new forum with a discussion and some posts.
      5. Remember to enrol the user to the forum course.
      6. Annotate the discussion Id from the URL (mod/forum/discuss.php?d=DISCUSSIONID)
      7. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, and the URL of your moodle instance and replacing the X (value of the discussionid) with the DISCUSSIONID you copied

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'discussionid=X&wsfunction=mod_forum_get_discussion_posts&wstoken=3cfbcfd3199db5c8846d771b4cc8f197' | python -m "json.tool"

      1. Confirm that after executing the request:
        • You got courseid and forumid fields and they are correct.
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for one user enrolled in the course (and not the admin): Click on Site administration ► Plugins ► Web services ► Manage tokens Create a new course Create a new forum with a discussion and some posts. Remember to enrol the user to the forum course. Annotate the discussion Id from the URL (mod/forum/discuss.php?d=DISCUSSIONID) Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, and the URL of your moodle instance and replacing the X (value of the discussionid) with the DISCUSSIONID you copied curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'discussionid=X&wsfunction=mod_forum_get_discussion_posts&wstoken=3cfbcfd3199db5c8846d771b4cc8f197' | python -m "json.tool" Confirm that after executing the request: You got courseid and forumid fields and they are correct.
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE
    • Pull 3.10 Branch:
      MDL-69577-310
    • Pull Master Branch:
      MDL-69577-master

      Description

      Direct navigation to a discussion in the app will get all posts of the discussion but will not have any info about forum or course that the discussion needs to show options like pin or attach files on reply.

      It will be great that near the posts return variable we could add forumid and courseid or even cmid.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pferre22 Pau Ferrer
              Reporter:
              pferre22 Pau Ferrer
              Peer reviewer:
              Amaia Anabitarte
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Gladys Basiana
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Nov/20

                  Time Tracking

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