Skip to content

fix: do not send daily digest email to user who is disabled - #1803

Merged
yemkareems merged 7 commits into
masterfrom
fix/834/dont-sent-digest-email-to-disabled-user
Oct 28, 2024
Merged

fix: do not send daily digest email to user who is disabled#1803
yemkareems merged 7 commits into
masterfrom
fix/834/dont-sent-digest-email-to-disabled-user

Conversation

@yemkareems

Copy link
Copy Markdown
Contributor

Add a extra check to not send the email to user who is disabled.

In my local i made jane a disabled user

image

And add the condition. This triggered a email to alice, bob and john. And it did not send the email to jane

image

@cypress

cypressBot commented Sep 24, 2024

Copy link
Copy Markdown

ActivityRun #2059

Run Properties:status check passed Passed #2059git commit8789e1bf33: fix: do not send daily digest email to user who is disabled
ProjectActivity
Branch Reviewfix/834/dont-sent-digest-email-to-disabled-user
Run statusstatus check passed Passed #2059
Run duration02m 56s
Commitgit commit8789e1bf33: fix: do not send daily digest email to user who is disabled
Committeryemkareems
View all properties for this run ↗︎

Test results
Tests that failedFailures0
Tests that were flakyFlaky1
Tests that did not run due to a developer annotating a test with .skipPending0
Tests that did not run due to a failure in a mocha hookSkipped0
Tests that passedPassing10
View all changes introduced in this branch ↗︎

@artongeartonge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems enough 👍

@come-nccome-nc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be possible to instead take an IUser object in sendDigestForUser and check the enabled state in parent method sendDigests ?
That would allow to also not update the activity.digest config value for disabled users, as that may be confusing. Would also be a bit better in performance to bail out earlier for disabled users.

@nickvergessen

Copy link
Copy Markdown
Member

That would allow to also not update the activity.digest config value for disabled users, as that may be confusing. Would also be a bit better in performance to bail out earlier for disabled users.

I was wondering if we should even call

$this->config->setUserValue($user->getUID(), 'activity', 'activity_digest_last_send', (string)$lastActivityId);

so after re-enabling the user is not spamed with old legacy info from the day they got disabled.

@yemkareems

Copy link
Copy Markdown
ContributorAuthor

That would allow to also not update the activity.digest config value for disabled users, as that may be confusing. Would also be a bit better in performance to bail out earlier for disabled users.

I was wondering if we should even call

$this->config->setUserValue($user->getUID(), 'activity', 'activity_digest_last_send', (string)$lastActivityId);

so after re-enabling the user is not spamed with old legacy info from the day they got disabled.

Hi @nickvergessen , @come-nc Do we need to do this for disabled user. I see there is a ACTIVITY_LIMIT and first time after re enabling user the notifications ll be cluttered and after that it should be fine. Please let me know and i ll do it accordingly

@yemkareems

yemkareems commented Sep 25, 2024

Copy link
Copy Markdown
ContributorAuthor

Hi @come-nc , @nickvergessen I will add the user disabled check in sendDigests method as Côme suggested but will also add one updateLastSentForUser which will do
$this->config->setUserValue($user->getUID(), 'activity', 'activity_digest_last_send', (string)$lastActivityId);
as Joas suggested.

@yemkareems

yemkareems commented Sep 26, 2024

Copy link
Copy Markdown
ContributorAuthor

Hi @come-nc, @nickvergessen I have done this change as requested but however i do not see a entry in oc_preferences for the disabled user(jane). I see the mail has gone out for admin user and only entry for admin user and not for the disabled user jane for whom i did some file rename just before disabling. Checking it locally now what is going wrong

image

@nickvergessen

Copy link
Copy Markdown
Member

Could you push, so we can see what your code is?

miaulalala
miaulalala previously requested changes Oct 14, 2024
Comment threadlib/DigestSender.php Outdated

@come-nccome-nc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good apart from 2 small changes.

Comment threadlib/DigestSender.php Outdated
Comment threadlib/DigestSender.php Outdated
… is not used
Signed-off-by: yemkareems <yemkareems@gmail.com>
@yemkareems

Copy link
Copy Markdown
ContributorAuthor

/backport to stable28

@yemkareems

Copy link
Copy Markdown
ContributorAuthor

/backport to stable29

@yemkareems

Copy link
Copy Markdown
ContributorAuthor

/backport to stable30

@artonge

Copy link
Copy Markdown
Collaborator

/backport to stable28

@yemkareems

Copy link
Copy Markdown
ContributorAuthor

/backport to stable29

1 similar comment
@artonge

Copy link
Copy Markdown
Collaborator

/backport to stable29

@artonge

Copy link
Copy Markdown
Collaborator

/backport to stable30

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@yemkareems@nickvergessen@artonge@miaulalala@provokateurin@come-nc@joshtrichards