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

Activity log filter by user #2924

Merged
merged 31 commits into from
Sep 13, 2024
Merged

Activity log filter by user #2924

merged 31 commits into from
Sep 13, 2024

Conversation

gagandeepb
Copy link
Contributor

@gagandeepb gagandeepb commented Aug 26, 2024

Description

Activity log filter by user.

Did you add the right label?

Remember to add the right labels to this PR.

  • DONE

How was this tested?

Describe the tests that have been added/changed for this new behavior.

Unit tests

  • DONE

Did you update the documentation?

Remember to ask yourself if your PR requires changes to the following documentation:

Add a documentation PR or write that no changes are required for the documentation.

No doc changes required.

  • DONE

@gagandeepb gagandeepb self-assigned this Aug 26, 2024
@gagandeepb gagandeepb added enhancement New feature or request javascript Pull requests that update Javascript code elixir Pull requests that update Elixir code env Create an ephimeral environment for the pr branch labels Aug 26, 2024
@gagandeepb gagandeepb marked this pull request as ready for review September 6, 2024 14:22
Copy link
Member

@nelsonkopliku nelsonkopliku left a comment

Choose a reason for hiding this comment

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

Hey @gagandeepb nice job!
Praise for the usage of channels/websockets instead of a new rest endpoint! I believe it puts us in a good spot.

Now, besides what already commented, I noticed a behaviour with deleted users that we need to take into account

  1. a deleted user's username is stored as <initialUsername>__<dateOfDeletion>. ie the foobar user, when deleted, becomes foobar__2024-09-09 08:37:57.605629Z
  2. usernames can be reused. ie there can be a new user foobar after the initial foobar user was deleted

That said, we need to decide what to do.
Options I see are:

  • we detect deleted user's usernames and extract only the relevant part (the one before the double underscore __), and remove duplicates in case there is another user with the same username. This leads to possibly returning, when searching the activity log by such user, entries for two different users: the one that was deleted plus the one currently in the system
  • we keep track and differentiate between deleted/current users with same usernames. This would require enriching the activity log entries with the identifier of the user (or a join table)

Let's check with @abravosuse as well.

assets/js/pages/ActivityLogPage/ActivityLogPage.test.jsx Outdated Show resolved Hide resolved
assets/js/state/activityLog.js Outdated Show resolved Hide resolved
assets/js/state/activityLog.js Outdated Show resolved Hide resolved
assets/js/state/activityLog.test.js Show resolved Hide resolved
assets/js/state/sagas/activityLog.js Show resolved Hide resolved
assets/js/state/selectors/activityLog.js Show resolved Hide resolved
test/trento/users_test.exs Outdated Show resolved Hide resolved
- needs some clean up
- Deletes unused code
- Pulls out state access into the ActivityLog page context
- Deletes unnecessary code from the composed filter
- Adds a new function the users context
- Adds needed context calls to the ActivityLog channel module
Renames some declarations
Fix for identityFunctionCheck warning in console.
- channel test for activity log
- activity log state test
Adds a hook that passes in requisite state to the ActivityLogPage component
Specific users in list are not necessary
Previously a system user was not returned; now it is possible to filter the system activity log entries.
Collapses usernames from deleted users into a username without timestamp suffix
alUsers -> activityLogUsers
According to PR conversation, the update push interval from the channel  is now a compile time Application env variable.
The users context function modified here now returns username tupled with the deleted_at timestamp. This simplifies somewhat the implementation of the collapse_usernames function in the ActivityLogChannel module. Specifically, this function no longer needs to do any DateTime parsing to infer soft deleted users/associated usernames.
This test makes use of non empty/non default state to assert on number of user filter options rendered.
Some changes introduced post rebase were breaking a test. This commit fixes the failing test.
@gagandeepb gagandeepb force-pushed the activity-log-filter-by-user branch from ccd8ac3 to bd7ca7c Compare September 12, 2024 15:54
- import re-ordering/spacing, etc.
Removes the trailing _ts
Copy link
Member

@nelsonkopliku nelsonkopliku left a comment

Choose a reason for hiding this comment

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

Great, thanks!

assets/js/pages/ActivityLogPage/ActivityLogPage.jsx Outdated Show resolved Hide resolved
assets/js/pages/ActivityLogPage/ActivityLogPage.jsx Outdated Show resolved Hide resolved
In order to minimize diffs/conflicts
@gagandeepb gagandeepb enabled auto-merge (squash) September 13, 2024 10:16
@gagandeepb gagandeepb merged commit 37aa303 into main Sep 13, 2024
26 checks passed
@gagandeepb gagandeepb deleted the activity-log-filter-by-user branch September 13, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elixir Pull requests that update Elixir code enhancement New feature or request env Create an ephimeral environment for the pr branch javascript Pull requests that update Javascript code
Development

Successfully merging this pull request may close these issues.

2 participants