Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mélanie Chauvel
funkwhale
Commits
daad6a5d
Verified
Commit
daad6a5d
authored
5 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
See #890: assign report to moderator on resolution
parent
05e36c74
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/funkwhale_api/manage/views.py
+8
-0
8 additions, 0 deletions
api/funkwhale_api/manage/views.py
api/tests/manage/test_views.py
+14
-0
14 additions, 0 deletions
api/tests/manage/test_views.py
with
22 additions
and
0 deletions
api/funkwhale_api/manage/views.py
+
8
−
0
View file @
daad6a5d
...
...
@@ -488,6 +488,14 @@ class ManageReportViewSet(
required_scope
=
"
instance:reports
"
ordering_fields
=
[
"
id
"
,
"
creation_date
"
,
"
handled_date
"
]
def
perform_update
(
self
,
serializer
):
is_handled
=
serializer
.
instance
.
is_handled
if
not
is_handled
and
serializer
.
validated_data
.
get
(
"
is_handled
"
)
is
True
:
# report was resolved, we assign to the mod making the request
serializer
.
save
(
assigned_to
=
self
.
request
.
user
.
actor
)
else
:
serializer
.
save
()
class
ManageNoteViewSet
(
mixins
.
ListModelMixin
,
...
...
This diff is collapsed.
Click to expand it.
api/tests/manage/test_views.py
+
14
−
0
View file @
daad6a5d
...
...
@@ -495,3 +495,17 @@ def test_report_update(factories, superuser_api_client):
assert
response
.
status_code
==
200
report
.
refresh_from_db
()
assert
report
.
is_handled
is
True
def
test_report_update_is_handled_true_assigns
(
factories
,
superuser_api_client
):
actor
=
superuser_api_client
.
user
.
create_actor
()
report
=
factories
[
"
moderation.Report
"
]()
url
=
reverse
(
"
api:v1:manage:moderation:reports-detail
"
,
kwargs
=
{
"
uuid
"
:
report
.
uuid
}
)
response
=
superuser_api_client
.
patch
(
url
,
{
"
is_handled
"
:
True
})
assert
response
.
status_code
==
200
report
.
refresh_from_db
()
assert
report
.
is_handled
is
True
assert
report
.
assigned_to
==
actor
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment