Skip to content

feat: Add API for retrieving moderation reason codes from the LMS settings [BD-38] [TNL-9479] [BB-5419]#30015

Merged
asadazam93 merged 1 commit intoopenedx:masterfrom
open-craft:felipetrz-kshitij/BB-5419-add-reason-codes-retrieval-api_
Mar 18, 2022
Merged

feat: Add API for retrieving moderation reason codes from the LMS settings [BD-38] [TNL-9479] [BB-5419]#30015
asadazam93 merged 1 commit intoopenedx:masterfrom
open-craft:felipetrz-kshitij/BB-5419-add-reason-codes-retrieval-api_

Conversation

@xitij2000
Copy link
Contributor

@xitij2000 xitij2000 commented Mar 4, 2022

Description

This introduces new settings variables for specifying a list of predefined reasons for editing and closing posts, along with an API endpoint for the discussions micro-frontend to retrieve those reasons. This also changes the behavior of the support implemented in TNL-8842 to validate the submitted reason codes on the server side.

New settings variables:

DISCUSSION_MODERATION_EDIT_REASON_CODES

DISCUSSION_MODERATION_CLOSE_REASON_CODES

Supporting information

Testing instructions

TODO Please provide detailed step-by-step instructions for testing this change.

Deadline

None

Other information

This change is a follow-up to, and depends on, the changes introduced in this PR.

@openedx-webhooks
Copy link

Thanks for the pull request, @xitij2000! I've created BLENDED-1123 to keep track of it in Jira. More details are on the BD-38 project page.

When this pull request is ready, tag your edX technical lead.

@openedx-webhooks openedx-webhooks added blended PR is managed through 2U's blended developmnt program needs triage labels Mar 4, 2022
@xitij2000 xitij2000 force-pushed the felipetrz-kshitij/BB-5419-add-reason-codes-retrieval-api_ branch from 89e3ec3 to 7e93ed5 Compare March 4, 2022 06:10
Copy link
Contributor

@tecoholic tecoholic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

  • I tested this:
    • Tested the API along with the UI while testing frontend-app-discussions#46.
    • Tested that the API returns eanbled only with the right Waffle flag on a per course basis.
    • Tested the API returns expected reasons
  • I read through the code
  • I checked for accessibility issues - Values introduced in the settings are wrapped in i18n utilities _() as expected
  • Includes documentation

@xitij2000 xitij2000 force-pushed the felipetrz-kshitij/BB-5419-add-reason-codes-retrieval-api_ branch from 7e93ed5 to f218858 Compare March 4, 2022 06:53
Comment on lines 1278 to 1318
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asadazam93 The original author of this PR made this a separate endpoint, but I'm wondering if it's better to just include this in the existing API endpoint at: /api/discussion/v1/courses/{course_id}/settings.

That endpoint also includes only moderator-specific settings such as course division settings. Thee are technically not settings and not modifyable.

They could also be added to /api/discussion/v1/courses/{course_id}/ which has discussions settings that are visible to users as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xitij2000 Agreed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asadazam93 OK. I'm thinking of moving these to the second API since regular users can access these and that might be useful in some situations. I see not reason to restrict the codes to moderators since regular users will be shown these messages in the end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asadazam93 I've merged this with the existing PR. If the new approach is OK. I will update the frontend as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xitij2000 Sure go ahead. I think in case the api is to be used by regular users as well a second api makes sense.

@xitij2000 xitij2000 force-pushed the felipetrz-kshitij/BB-5419-add-reason-codes-retrieval-api_ branch 2 times, most recently from e45d4cc to af2753c Compare March 10, 2022 14:32
@tecoholic
Copy link
Contributor

@xitij2000 👍 For the new API merge

  • I tested this: API on the browser
  • I read through the code

@xitij2000 xitij2000 force-pushed the felipetrz-kshitij/BB-5419-add-reason-codes-retrieval-api_ branch from af2753c to 947f416 Compare March 10, 2022 17:06
@asadazam93
Copy link
Contributor

@xitij2000 is this ready to be reviewed?

@xitij2000
Copy link
Contributor Author

@xitij2000 is this ready to be reviewed?

Yes.

…es from the LMS settings

Reason codes will be used by the frontend to list and validate the reasons for specifying moderation actions.

Co-authored-by: Kshitij Sobti <kshitij@opencraft.com>
@xitij2000 xitij2000 force-pushed the felipetrz-kshitij/BB-5419-add-reason-codes-retrieval-api_ branch from 947f416 to 1ee15ed Compare March 17, 2022 10:24
@xitij2000
Copy link
Contributor Author

@asadazam93 Updated this PR to remove merge conflicts.

@asadazam93 asadazam93 merged commit f3b8977 into openedx:master Mar 18, 2022
@openedx-webhooks
Copy link

@xitij2000 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

@xitij2000 xitij2000 deleted the felipetrz-kshitij/BB-5419-add-reason-codes-retrieval-api_ branch March 19, 2022 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blended PR is managed through 2U's blended developmnt program merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants