-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Prevent email reports when consolidated view ineligible #5882
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
Conversation
lib/workers/send_email_report.ex
Outdated
| not Plausible.Sites.consolidated?(site) or | ||
| Plausible.ConsolidatedView.ok_to_display?(site.team) |
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.
Maybe something verbose but expressive like:
| not Plausible.Sites.consolidated?(site) or | |
| Plausible.ConsolidatedView.ok_to_display?(site.team) | |
| Plausible.Sites.regular?(site) or | |
| (Plausible.Sites.consolidated?(site) and Plausible.ConsolidatedView.ok_to_display?(site.team)) |
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 | ||
| defp handle_notification(%TrafficChangeNotification{type: :drop} = notification, now) do | ||
| current_visitors = Clickhouse.current_visitors_12h(notification.site) |
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.
ooh, does this already work with multiple site ids?
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.
Yes. #5876 made it work.
lib/workers/send_email_report.ex
Outdated
|
|
||
| if report do | ||
| with %Plausible.Site{} <- site, | ||
| %{} = report <- Map.get(site, report_type), |
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.
fetch!?
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.
Yup, makes sense. 2b9223f
Changes
When email reports (such as weekly reports, or traffic drop notifications) have been scheduled for consolidated views, we need to check upon sending, whether the consolidated view is still "eligible".
Tests
Changelog
Documentation
Dark mode