-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add username to activity log metadata on user deletion #3091
Conversation
738417d
to
b522d73
Compare
ce8005c
to
4d0516d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @balanza thanks for this.
The main thing we need to address is making sure the tagging enrichment detection does not conflict with username enrichment detection.
Then there is the point about the deleted user's username.
I personally believe it'd be more friendly tracking without the leading deletion timestamp. I know, it's ugly, but it is what it is.
2b3ec87
to
30f29cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM.
The only reserve I have is that I'd find it more consistent if in the log we track the deleted user's username stripped from the deletion timestamp.
Let's proceed anyways. If needed we can follow up on that.
30f29cb
to
3e1decc
Compare
|
||
defp detect_enrichment(_target_entity, {_activity, _metadata}), | ||
do: {:error, :no_enrichment_needed} | ||
|
||
defp polish_entity(%{username: username, deleted_at: deleted_at} = entity) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you would add this to the Users.by_id/1
👀 However, as you wish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, huge no. I won't add a custom patch to a context. I'm already ashamed to add a patch at this level, but I can swallow it.
Whether the data is "dirty" or not must be decided by the context, in a dedicated discussion hopefully
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see. Fine with this, thanks 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to rebase and have a clean history of the PR.
Besides this LGTM
f0f3e80
to
059b48c
Compare
clean_username = | ||
String.trim_trailing(username, "__" <> DateTime.to_string(deleted_at)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Minor clarification] I wonder: do we need to guard against the deleted_at
value being nil
? Otherwise looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should never happen but I see no harm in doing it.
059b48c
to
55232e5
Compare
55232e5
to
1fc23c8
Compare
Description
Add username to activity log metadata on user deletion.
Being the user have been soft deleted, its username must be polished before presenting.