Add ability to email announcements to all users (#33928)
This commit is contained in:
parent
d2ce9a6064
commit
5a100bf38f
20 changed files with 275 additions and 11 deletions
|
@ -4,17 +4,18 @@
|
|||
#
|
||||
# Table name: announcements
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# text :text default(""), not null
|
||||
# published :boolean default(FALSE), not null
|
||||
# all_day :boolean default(FALSE), not null
|
||||
# scheduled_at :datetime
|
||||
# starts_at :datetime
|
||||
# ends_at :datetime
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# published_at :datetime
|
||||
# status_ids :bigint(8) is an Array
|
||||
# id :bigint(8) not null, primary key
|
||||
# all_day :boolean default(FALSE), not null
|
||||
# ends_at :datetime
|
||||
# notification_sent_at :datetime
|
||||
# published :boolean default(FALSE), not null
|
||||
# published_at :datetime
|
||||
# scheduled_at :datetime
|
||||
# starts_at :datetime
|
||||
# status_ids :bigint(8) is an Array
|
||||
# text :text default(""), not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
class Announcement < ApplicationRecord
|
||||
|
@ -54,6 +55,10 @@ class Announcement < ApplicationRecord
|
|||
update!(published: false, scheduled_at: nil)
|
||||
end
|
||||
|
||||
def notification_sent?
|
||||
notification_sent_at.present?
|
||||
end
|
||||
|
||||
def mentions
|
||||
@mentions ||= Account.from_text(text)
|
||||
end
|
||||
|
@ -86,6 +91,10 @@ class Announcement < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def scope_for_notification
|
||||
User.confirmed.joins(:account).merge(Account.without_suspended)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def grouped_ordered_announcement_reactions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue