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

The new function `mod_forum_get_discussion_posts` from the webservices does not return the last_modified attribute.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Tested
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.7.8, 3.8.5, 3.9.2
    • Fix Version/s: 3.11
    • Component/s: Forum, Web Services
    • Labels:
    • Testing Instructions:
      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  
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_311_STABLE
    • Pull 3.11 Branch:
      MDL-70037-311
    • Pull Master Branch:

      Description

      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?

        Attachments

          Activity

            People

            Assignee:
            pholden Paul Holden
            Reporter:
            c0d3d3v C0D3D3V
            Peer reviewer:
            Peter Dias
            Integrator:
            Sara Arjona (@sarjona)
            Tester:
            Anna Carissa Sadia
            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:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Fix Release Date:
              10/May/21

                Time Tracking

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