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

Update mod_forum_get_discussion_posts web service to return the last_modified attribute

XMLWordPrintable

    • MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_311_STABLE
    • Hide
      1. Login as admin
      2. Create a new course and enrol student
      3. Visit the Announcements forum
      4. Press Add a new topic
      5. Enter Subject & Message and press Post to forum
      6. Add a reply to the new discussion
      7. Note the discussion ID in your browser URL: ?d=<ID>
      8. Create a Token for the student user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      9. Enable web services
      10. Execute the mod_forum_get_discussion_posts external method simulating a WS client with the student user, substituting your URL, the <ID> value as appropriate and <WSTOKEN> for student user, e.g.:

        $ curl -s 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_get_discussion_posts&discussionid=<ID>&wstoken=<WSTOKEN>' | python -m json.tool
        

      11. Confirm each returned post structure in the discussion contains a timemodified property

       

      Show
      Login as admin Create a new course and enrol student Visit the Announcements forum Press Add a new topic Enter Subject & Message and press Post to forum Add a reply to the new discussion Note the discussion ID in your browser URL: ?d=<ID> Create a Token for the student user: Click on Site administration ► Plugins ► Web services ► Manage tokens Enable web services Execute the mod_forum_get_discussion_posts external method simulating a WS client with the student user, substituting your URL, the  <ID> value as appropriate and <WSTOKEN> for student user, e.g.: $ curl -s 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_forum_get_discussion_posts&discussionid=<ID>&wstoken=<WSTOKEN>' | python -m json.tool Confirm each returned post structure in the discussion contains a timemodified property  

      The old function `mod_forum_get_forum_discussion_posts` does return the attribute `modified` for every post (See here https://github.com/moodle/moodle/blob/149fdcf075fdf816b9e83f59e02a5ef20fa998fe/mod/forum/externallib.php#L468). But the new function `mod_forum_get_discussion_posts` does not (see here https://github.com/moodle/moodle/blob/a411b499b98afc9901c24a9466c7e322946a04aa/mod/forum/classes/local/exporters/post.php#L92).

      Is that  intended? Why is there the possibility to sort by last modified, but you don't get the attribute back? How else can you get this attribute?

        1. MDL-70037.jpg
          62 kB
          Anna Carissa Sadia

            pholden Paul Holden
            c0d3d3v C0D3D3V
            Peter Dias Peter Dias
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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