Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.6.4, 3.7, 3.7 regressions, 3.8
-
MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
-
MOODLE_36_STABLE, MOODLE_37_STABLE
-
MDL-65665-master-2 -
Hide
Need this testing in all branches, specifically 36_STABLE, where a new function is being added.
- # Log in as Admin
- Create a course.
- Create a Forum.
- Create 2 discussions (discussion1, discussion2).
- Enrol a user in the Course.
Test auto-subscription
- Log in as the User enrolled in the Course.
- Go to the Forum
- make sure the user is not subscribed to discussion1 and discussion2.
- Go to User preferences > Forum preferences
- set Forum auto-subscribe = "Yes: when I post, subscribe me to that forum discussion"
- Go back to the Forum.
- Go to discussion1.
- Add an inline reply to a discussion post.
- make sure the User is now automatically subscribed to discussion1 (reload might be needed to update the subscribe button in the discussion page)
- Go to User preferences > Forum preferences
- set Forum auto-subscribe = "No: don't automatically subscribe me to forum discussions"
- Go back to the Forum.
- Go to discussion2.
- Add an inline reply to a discussion post.
- make sure the User is still not subscribed to discussion2 (reload might be needed to update the subscribe button in the discussion page)**
Test webservice
- Log in as Admin.
- Enable web services (Site administration > Advanced features).
- Create a tokens for the User which is enrolled in the Course (Site administration > Plugins > Web services > Manage tokens).
Please follow the additional instructions on how to configure/use web services (https://docs.moodle.org/37/en/Using_web_services) - Log in as User.
- Go to the Course > Forum.
- Unsubscribe from discussion1 and discussion2.
- Call the mod_forum_add_discussion_post web service as the User (discussionsubscribe = 1)
through a HTTP client for testing web services (ex. Postman) where:MOODLEINSTANCE/webservice/rest/server.php?wsfunction=mod_forum_add_discussion_post&wstoken=TOKEN&postid=POSTID&subject=REPLYSUBJECT&message=REPLYMESSAGE&options[0][name]=discussionsubscribe&options[0][value]=1
wstoken = the token created for the User;
postid = the ID of the discussion1 post the user is replying to;
subject = the reply subject
message = the reply message
options = additional option parameters - Log in as User.
- Go to the Course > Forum > Discussion1
- make sure the User is now automatically subscribed to Discussion1 and the post reply has been successfully created.
- Call the mod_forum_add_discussion_post web service as the User (discussionsubscribe = 0)
through a HTTP client for testing web services (ex. Postman) where:MOODLEINSTANCE/webservice/rest/server.php?wsfunction=mod_forum_add_discussion_post&wstoken=TOKEN&postid=POSTID&subject=REPLYSUBJECT&message=REPLYMESSAGE&options[0][name]=discussionsubscribe&options[0][value]=0
postid = the ID of the discussion2 post the user is replying to; - As User, go to Course > Forum > DIscussion2
- make sure the User is still not subscribed to Discussion2 and the post reply has been successfully created.
- As User, go to User preferences > Forum preferences
- set Forum auto-subscribe = "Yes: when I post, subscribe me to that forum discussion"
- Call the mod_forum_add_discussion_post web service as the User, without passing a value for discussionsubscribe
through a HTTP client for testing web services (ex. Postman) where:MOODLEINSTANCE/webservice/rest/server.php?wsfunction=mod_forum_add_discussion_post&wstoken=TOKEN&postid=POSTID&subject=REPLYSUBJECT&message=REPLYMESSAGE
postid = the ID of the discussion2 post the user is replying to; - Go to the Course > Forum > Discussion2
- make sure the User is now automatically subscribed to Discussion2 and the post reply has been successfully created.
ShowNeed this testing in all branches, specifically 36_STABLE, where a new function is being added. # Log in as Admin Create a course. Create a Forum. Create 2 discussions (discussion1, discussion2). Enrol a user in the Course. Test auto-subscription Log in as the User enrolled in the Course. Go to the Forum make sure the user is not subscribed to discussion1 and discussion2. Go to User preferences > Forum preferences set Forum auto-subscribe = "Yes: when I post, subscribe me to that forum discussion" Go back to the Forum. Go to discussion1. Add an inline reply to a discussion post. make sure the User is now automatically subscribed to discussion1 (reload might be needed to update the subscribe button in the discussion page) Go to User preferences > Forum preferences set Forum auto-subscribe = "No: don't automatically subscribe me to forum discussions" Go back to the Forum. Go to discussion2. Add an inline reply to a discussion post. make sure the User is still not subscribed to discussion2 (reload might be needed to update the subscribe button in the discussion page) ** Test webservice Log in as Admin. Enable web services (Site administration > Advanced features). Create a tokens for the User which is enrolled in the Course (Site administration > Plugins > Web services > Manage tokens). Please follow the additional instructions on how to configure/use web services ( https://docs.moodle.org/37/en/Using_web_services ) Log in as User. Go to the Course > Forum. Unsubscribe from discussion1 and discussion2. Call the mod_forum_add_discussion_post web service as the User (discussionsubscribe = 1) MOODLEINSTANCE/webservice/rest/server.php?wsfunction=mod_forum_add_discussion_post&wstoken=TOKEN&postid=POSTID&subject=REPLYSUBJECT&message=REPLYMESSAGE&options [0] [name] =discussionsubscribe&options [0] [value] =1 through a HTTP client for testing web services (ex. Postman) where: wstoken = the token created for the User; postid = the ID of the discussion1 post the user is replying to; subject = the reply subject message = the reply message options = additional option parameters Log in as User. Go to the Course > Forum > Discussion1 make sure the User is now automatically subscribed to Discussion1 and the post reply has been successfully created. Call the mod_forum_add_discussion_post web service as the User (discussionsubscribe = 0) MOODLEINSTANCE/webservice/rest/server.php?wsfunction=mod_forum_add_discussion_post&wstoken=TOKEN&postid=POSTID&subject=REPLYSUBJECT&message=REPLYMESSAGE&options [0] [name] =discussionsubscribe&options [0] [value] =0 through a HTTP client for testing web services (ex. Postman) where: postid = the ID of the discussion2 post the user is replying to; As User, go to Course > Forum > DIscussion2 make sure the User is still not subscribed to Discussion2 and the post reply has been successfully created. As User, go to User preferences > Forum preferences set Forum auto-subscribe = "Yes: when I post, subscribe me to that forum discussion" Call the mod_forum_add_discussion_post web service as the User, without passing a value for discussionsubscribe MOODLEINSTANCE/webservice/rest/server.php?wsfunction=mod_forum_add_discussion_post&wstoken=TOKEN&postid=POSTID&subject=REPLYSUBJECT&message=REPLYMESSAGE through a HTTP client for testing web services (ex. Postman) where: postid = the ID of the discussion2 post the user is replying to; Go to the Course > Forum > Discussion2 make sure the User is now automatically subscribed to Discussion2 and the post reply has been successfully created.
Description
The code used in mod/forum/post.php is:
$discussionsubscribe = \mod_forum\subscriptions::get_user_default_subscription($forumrecord, $coursecontext, $cm, null);
|
The code in the add_discussion_post WS defaults to true
Attachments
- MDL-65665.jpg
- 50 kB
- MDL-65665 (2).jpg
- 52 kB
- MDL-65665 (3).jpg
- 32 kB
Issue Links
- Discovered while testing
-
MDLSITE-5811 Forum mailings and maintenance jobs scheduled task not running on moodle.org
-
- Resolved
-