feat: add edit_reason_code and close_reason_code (#29609)
Add `edit_reason_code` field to both `Comments` and `Threads`, making it editable for anyone who can also edit `raw_body`. Add `close_reason_code` field to `Threads`, and make it editable by anyone who can also edit `closed`.
This commit is contained in:
committed by
GitHub
parent
626a0e112e
commit
6bfb741c4a
@@ -14,12 +14,12 @@ class Comment(models.Model):
|
||||
'endorsed', 'parent_id', 'thread_id', 'username', 'votes', 'user_id',
|
||||
'closed', 'created_at', 'updated_at', 'depth', 'at_position_list',
|
||||
'type', 'commentable_id', 'abuse_flaggers', 'endorsement',
|
||||
'child_count',
|
||||
'child_count', 'edit_history',
|
||||
]
|
||||
|
||||
updatable_fields = [
|
||||
'body', 'anonymous', 'anonymous_to_peers', 'course_id', 'closed',
|
||||
'user_id', 'endorsed', 'endorsement_user_id',
|
||||
'user_id', 'endorsed', 'endorsement_user_id', 'edit_reason_code',
|
||||
]
|
||||
|
||||
initializable_fields = updatable_fields
|
||||
|
||||
@@ -21,19 +21,20 @@ class Thread(models.Model):
|
||||
'highlighted_body', 'endorsed', 'read', 'group_id', 'group_name', 'pinned',
|
||||
'abuse_flaggers', 'resp_skip', 'resp_limit', 'resp_total', 'thread_type',
|
||||
'endorsed_responses', 'non_endorsed_responses', 'non_endorsed_resp_total',
|
||||
'context', 'last_activity_at',
|
||||
'context', 'last_activity_at', 'closed_by', 'close_reason_code', 'edit_history',
|
||||
]
|
||||
|
||||
# updateable_fields are sent in PUT requests
|
||||
updatable_fields = [
|
||||
'title', 'body', 'anonymous', 'anonymous_to_peers', 'course_id', 'read',
|
||||
'closed', 'user_id', 'commentable_id', 'group_id', 'group_name', 'pinned', 'thread_type'
|
||||
'closed', 'user_id', 'commentable_id', 'group_id', 'group_name', 'pinned', 'thread_type',
|
||||
'close_reason_code', 'edit_reason_code',
|
||||
]
|
||||
|
||||
# metric_tag_fields are used by Datadog to record metrics about the model
|
||||
metric_tag_fields = [
|
||||
'course_id', 'group_id', 'pinned', 'closed', 'anonymous', 'anonymous_to_peers',
|
||||
'endorsed', 'read'
|
||||
'endorsed', 'read',
|
||||
]
|
||||
|
||||
# initializable_fields are sent in POST requests
|
||||
|
||||
Reference in New Issue
Block a user