Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Open sidebar
Tiger Ton
mastodon
Commits
07cc201a
Unverified
Commit
07cc201a
authored
2 years ago
by
Eugen Rochko
Committed by
GitHub
2 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix using wrong policy on status-related actions in admin UI (#19490)
parent
8ae0936d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/admin/status_batch_action.rb
+2
-2
app/models/admin/status_batch_action.rb
app/models/trends/status_batch.rb
+2
-2
app/models/trends/status_batch.rb
with
4 additions
and
4 deletions
+4
-4
app/models/admin/status_batch_action.rb
+
2
-
2
View file @
07cc201a
...
...
@@ -40,7 +40,7 @@ class Admin::StatusBatchAction
end
def
handle_delete!
statuses
.
each
{
|
status
|
authorize
(
status
,
:destroy?
)
}
statuses
.
each
{
|
status
|
authorize
(
[
:admin
,
status
]
,
:destroy?
)
}
ApplicationRecord
.
transaction
do
statuses
.
each
do
|
status
|
...
...
@@ -75,7 +75,7 @@ class Admin::StatusBatchAction
statuses
.
includes
(
:media_attachments
,
:preview_cards
).
find_each
do
|
status
|
next
unless
status
.
with_media?
||
status
.
with_preview_card?
authorize
(
status
,
:update?
)
authorize
(
[
:admin
,
status
]
,
:update?
)
if
target_account
.
local?
UpdateStatusService
.
new
.
call
(
status
,
representative_account
.
id
,
sensitive:
true
)
...
...
This diff is collapsed.
Click to expand it.
app/models/trends/status_batch.rb
+
2
-
2
View file @
07cc201a
...
...
@@ -30,7 +30,7 @@ class Trends::StatusBatch
end
def
approve!
statuses
.
each
{
|
status
|
authorize
(
status
,
:review?
)
}
statuses
.
each
{
|
status
|
authorize
(
[
:admin
,
status
]
,
:review?
)
}
statuses
.
update_all
(
trendable:
true
)
end
...
...
@@ -45,7 +45,7 @@ class Trends::StatusBatch
end
def
reject!
statuses
.
each
{
|
status
|
authorize
(
status
,
:review?
)
}
statuses
.
each
{
|
status
|
authorize
(
[
:admin
,
status
]
,
:review?
)
}
statuses
.
update_all
(
trendable:
false
)
end
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets