forked from e621ng/e621ng
[PostSets] Fix exception on admin update
This code path had a few issues which weren't triggered previously. Also changes the visibility change modaction to track the new visibility.
This commit is contained in:
parent
babffdf2d4
commit
4168692f2d
@ -53,11 +53,11 @@ class PostSetsController < ApplicationController
|
||||
|
||||
unless @post_set.is_owner?(CurrentUser.user)
|
||||
if @post_set.saved_change_to_is_public?
|
||||
ModAction.log(:set_mark_private, {set_id: @post_set.id, user_id: @post_set.creator_id})
|
||||
ModAction.log(:set_change_visibility, { set_id: @post_set.id, user_id: @post_set.creator_id, is_public: @post_set.is_public })
|
||||
end
|
||||
|
||||
if @post_set.saved_change_to_watched_attribute?
|
||||
Modaction.log(:set_update, {set_id: @post_set.id, user_id: @post_set.creator_id})
|
||||
if @post_set.saved_change_to_watched_attributes?
|
||||
ModAction.log(:set_update, { set_id: @post_set.id, user_id: @post_set.creator_id })
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -100,8 +100,8 @@ class ModActionDecorator < ApplicationDecorator
|
||||
|
||||
### Set ###
|
||||
|
||||
when "set_mark_private"
|
||||
"Made set ##{vals['set_id']} by #{user} private"
|
||||
when "set_change_visibility"
|
||||
"Made set ##{vals['set_id']} by #{user} #{vals['is_public'] ? 'public' : 'private'}"
|
||||
when "set_update"
|
||||
"Edited set ##{vals['set_id']} by #{user}"
|
||||
when "set_delete"
|
||||
|
@ -46,7 +46,7 @@ class ModAction < ApplicationRecord
|
||||
:report_reason_update,
|
||||
:set_update,
|
||||
:set_delete,
|
||||
:set_mark_private,
|
||||
:set_change_visibility,
|
||||
:tag_alias_create,
|
||||
:tag_alias_update,
|
||||
:tag_implication_create,
|
||||
|
@ -66,7 +66,7 @@ class PostSet < ApplicationRecord
|
||||
end
|
||||
|
||||
def saved_change_to_watched_attributes?
|
||||
saved_change_to_name? || saved_change_to_shortname? || saved_change_to_description?
|
||||
saved_change_to_name? || saved_change_to_shortname? || saved_change_to_description? || saved_change_to_transfer_on_delete?
|
||||
end
|
||||
|
||||
module ValidationMethods
|
||||
|
Loading…
Reference in New Issue
Block a user