-
Notifications
You must be signed in to change notification settings - Fork 65
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
Exclude specified users from activity expiration #1635
base: master
Are you sure you want to change the base?
Conversation
akhil1508
commented
Apr 11, 2024
- On my nextcloud setup, I want to keep activities only for a few months for all users
- However, the admin activities should be there forever as they provide a great way of keeping track of admin actions and also user actions that set the activity user as admin
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.
Looks good
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.
Could you take a look at the CI errors?
@artonge Apologies, I didn't run PHP CS Fixer; should be good now |
@artonge I don't understand
As I didn't change |
You need to register the IConfig injection to activity/lib/AppInfo/Application.php Lines 113 to 119 in 59e65d4
$context->registerService(Data::class, function (ContainerInterface $c) {
return new Data(
$c->get(IManager::class),
$c->get('ActivityConnectionAdapter'),
$c->get(LoggerInterface::class),
$c->get(IConfig::class),
);
}); |
558589c
to
750eef8
Compare
Could you also squash your commits into one? |
750eef8
to
fac1883
Compare
@artonge done |
Tests need the new constructor properties :) |
lib/Data.php
Outdated
if (!empty($excludedUsers)) { | ||
foreach ($excludedUsers as $user) { | ||
$condition1 = [ | ||
'user' => [$user, '!='] |
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.
should be only the affecteduser
below.
This here would mean that actions of the given user would never expire.
Also this breaks the index usage of an already problematic query. So should only be used with care
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.
@nickvergessen I'm confused, is the affecteduser
the user for whom the activity is fired off or is the affecteduser
the user the user who the activity is for?
If a user deleted an account and an activity for admins is fired, would the affecteduser
row be the deleted username or the admin username? I want all the activities that are fired for admin users to not expire, to maintain a history of important activities..
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.
User is the actor of the action,
Affected user is the one viewing the activity stream
But then it shows a bit that the config option needs better explanation.
But I still think that only 1 of the checks should stay
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 want all the activities that are fired for admin users to not expire, to maintain a history of important activities..
Btw there is also the audit log feature in Nextcloud which is specifically designed for things like this:
https://docs.nextcloud.com/server/latest/developer_manual/basics/logging.html#admin-audit-logging
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.
@nickvergessen But then I need to add some new code or patch the files on server as admin audit logs these user deletion and other important actions at "INFO" level.. It uses the loglevel
variable and if I allow "INFO" level logs, I'm afraid performance takes a hit for my server :(
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.
should be only the affecteduser below.
@nickvergessen Done
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.
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! |
@miaulalala Done. I will squash again and fix commit push after final approval(s) to avoid doing it many times. |
Still one minor lint error |
029ca38
to
df726e5
Compare
Signed-off-by: Akhil <akhil@e.email> Co-authored-by: Louis <louis@chmn.me>
2a8292f
to
6ed9908
Compare
@artonge Fixed |
Almost :) |