-
Notifications
You must be signed in to change notification settings - Fork 67
[Announcement] Add one time notice mailer #11086
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8183203
Add one time notice mailer
polypixeldev 64ce58d
Add one time job for sending announcement notice
polypixeldev 5c63702
Merge branch 'main' into polypixeldev/announcements-notice
polypixeldev 1186895
Fix ERB formatting
polypixeldev 0a351cc
Remove extra newline
polypixeldev ab66cc8
Update email copy
polypixeldev b9c94f7
Merge branch 'main' into polypixeldev/announcements-notice
polypixeldev 555fadb
Add filter to who should have auto-enabled monthly announcements
polypixeldev 7efdc89
Merge branch 'main' into polypixeldev/announcements-notice
polypixeldev 6d99988
Remove auto-enabling monthly announcements
polypixeldev 992ff25
Discard changes to app/models/announcement/templates/monthly.rb
polypixeldev 0dbe555
Edit email copy
polypixeldev 6081816
Update mail subject
polypixeldev 158ef8e
Merge branch 'main' into polypixeldev/announcements-notice
polypixeldev 780af48
Update email copy
polypixeldev 7291ca6
Merge branch 'main' into polypixeldev/announcements-notice
polypixeldev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module OneTimeJobs | ||
class SendAnnouncementNotice < ApplicationJob | ||
def self.perform | ||
# Rate limit is 14/s, but putting 12 here to be safe and allow for other emails to be sent | ||
queue = Limiter::RateQueue.new(12, interval: 1) | ||
|
||
Event.includes(:config).where(config: { generate_monthly_announcement: true }).find_each do |event| | ||
monthly_announcement = event.announcements.monthly.last | ||
|
||
if monthly_announcement.present? | ||
queue.shift | ||
AnnouncementMailer.with(event:, monthly_announcement:).notice.deliver_now | ||
end | ||
end | ||
end | ||
|
||
end | ||
|
||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<p> | ||
Hey<%= " all" if @emails.size > 1 %>, | ||
</p> | ||
|
||
<p> | ||
We recently launched a new feature on HCB - organization announcements! This will help you send out announcements on HCB to people who follow your organization. | ||
For more details, check out <%= link_to "our blog post", "https://blog.hcb.hackclub.com/posts/organization-announcements" %> and the new Announcements page on any of your organizations. | ||
</p> | ||
|
||
<p> | ||
Your organization also has monthly announcements enabled! | ||
This is a feature that automatically generates an announcement each month to send out to your followers. | ||
</p> | ||
|
||
<p> | ||
By default, they will include a short message and public data about your organization from the past month such as donation and spending summaries, but you can edit the announcement to include whatever you'd like. | ||
We've already generated your first monthly announcement to be sent on <%= @scheduled_for.strftime("%B #{@scheduled_for.day.ordinalize}") %> - <%= link_to "view or edit it on HCB", announcement_url(@monthly_announcement) %>! | ||
</p> | ||
|
||
<p>If you would like to disable monthly announcements, you can do so in <%= link_to "your organization settings", edit_event_url(@event) %>.</p> | ||
|
||
<p> | ||
Sincerely, | ||
<br><br> | ||
The HCB Team | ||
</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
concern: does this mean we'll keep sending these until they post an announcement?
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.
No, this was just meant to be a one time email - the check for monthly announcement is present is in case an event enabled generating monthly announcements after this month's job ran