-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AO3-6058 Merge branch 'master' into AO3-6058
- Loading branch information
Showing
28 changed files
with
566 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -409,6 +409,7 @@ def tag_search_params | |
:type, | ||
:canonical, | ||
:created_at, | ||
:uses, | ||
:sort_column, | ||
:sort_direction | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
module UserLoggable | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
before_destroy :log_removal_of_self_from_fnok_relationships | ||
end | ||
|
||
def log_removal_of_self_from_fnok_relationships | ||
fannish_next_of_kins.each do |fnok| | ||
fnok.user.log_removal_of_next_of_kin(self) | ||
end | ||
|
||
successor = fannish_next_of_kin&.kin | ||
log_removal_of_next_of_kin(successor) | ||
end | ||
|
||
def log_assignment_of_next_of_kin(kin, admin:) | ||
log_user_history( | ||
ArchiveConfig.ACTION_ADD_FNOK, | ||
options: { fnok_user_id: kin.id }, | ||
admin: admin | ||
) | ||
|
||
kin.log_user_history( | ||
ArchiveConfig.ACTION_ADDED_AS_FNOK, | ||
options: { fnok_user_id: self.id }, | ||
admin: admin | ||
) | ||
end | ||
|
||
def log_removal_of_next_of_kin(kin, admin: nil) | ||
return if kin.blank? | ||
|
||
log_user_history( | ||
ArchiveConfig.ACTION_REMOVE_FNOK, | ||
options: { fnok_user_id: kin.id }, | ||
admin: admin | ||
) | ||
|
||
kin.log_user_history( | ||
ArchiveConfig.ACTION_REMOVED_AS_FNOK, | ||
options: { fnok_user_id: self.id }, | ||
admin: admin | ||
) | ||
end | ||
|
||
def log_user_history(action, options: {}, admin: nil) | ||
if admin.present? | ||
options = { | ||
admin_id: admin.id, | ||
note: "Change made by #{admin.login}", | ||
**options | ||
} | ||
end | ||
|
||
create_log_item({ | ||
action: action, | ||
**options | ||
}) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.