Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AO3-6467 Log on kin side when a user with a fnok is deleted #4633

Merged
merged 17 commits into from
Oct 1, 2023

Conversation

ceithir
Copy link
Contributor

@ceithir ceithir commented Sep 20, 2023

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-6467?focusedCommentId=360484

Purpose

The logging of fannish next of kin addition and removal as previously coded was trying to be too clever, only saving data on the forebear side then inferring what to display on their successor side from that. This caused not only convoluted code but also bugs in the context of user deletion.

This PR moved to a more straightforward if more verbose approach by explicitly logging any change on both sides.

Testing Instructions

As per the JIRA

References

Untouched (as the visible behavior didn't change save for one bugfix) but nonetheless relevant end-to-end tests

Credit

Ceithir (he/him)
Note: weeklies (she/her) also contributed code to this feature in a previous PR

@github-actions github-actions bot added Has Migrations Contains migrations and therefore needs special attention when deploying Awaiting Review labels Sep 20, 2023
app/controllers/admin/admin_users_controller.rb Outdated Show resolved Hide resolved
@@ -180,6 +180,11 @@ def log_removal_as_next_of_kin
fnok_user_id: self.id
})
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be neater if the logging methods log_removal_as_next_of_kin and log_next_of_kin_removed went into users_helper?

We could name them as
log_removal_as_next_of_kin and
log_admin_removal_as_next_of_kin to be clear about the distinction.

I also think having some brief comments/named variables would be helpful for this method, as the ...kin.kin might be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the content of the app/helpers folder, including users_helper is only supposed to be for methods used in views?

Regardless, moving all that mess to its own file indeed seems like a goo idea.

@brianjaustin brianjaustin added the Priority: High - Broken on Test Merge immediately after approval label Sep 20, 2023
Copy link
Contributor

@weeklies weeklies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some general comments.

@@ -0,0 +1,52 @@
module UserHistory
def log_assignment_of_next_of_kin(user, kin, admin:)

This comment was marked as resolved.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the : is to mark admin as a (required) keyword argument, rather than a positional one: https://docs.ruby-lang.org/en/master/syntax/methods_rdoc.html#label-Keyword+Arguments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! TIL.

app/models/user.rb Outdated Show resolved Hide resolved
app/models/user.rb Outdated Show resolved Hide resolved
lib/user_history.rb Outdated Show resolved Hide resolved
@brianjaustin brianjaustin added this to the 0.9.351 milestone Sep 25, 2023
lib/kin_history.rb Outdated Show resolved Hide resolved
@sarken sarken merged commit f21f823 into otwcode:master Oct 1, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Has Migrations Contains migrations and therefore needs special attention when deploying Priority: High - Broken on Test Merge immediately after approval Reviewed: Ready to Merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants