Compare commits
7 Commits
main
...
admin_mail
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7bc1014c2 | ||
|
|
b6a43c5b99 | ||
|
|
878596fe99 | ||
|
|
b50a3edb20 | ||
|
|
21406e9212 | ||
|
|
ea6ebc1eb7 | ||
|
|
2c59ace35b |
@@ -1,6 +1,7 @@
|
||||
<%= raw t('admin_mailer.new_trends.new_trending_links.title') %>
|
||||
|
||||
<% new_trending_links.each do |link| %>
|
||||
<%= next unless link.trend.present? %>
|
||||
- <%= link.title %> · <%= link.url %>
|
||||
<%= standard_locale_name(link.language) %> · <%= raw t('admin.trends.links.usage_comparison', today: link.history.get(Time.now.utc).accounts, yesterday: link.history.get(Time.now.utc - 1.day).accounts) %> · <%= t('admin.trends.tags.current_score', score: link.trend.score.round(2)) %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<%= raw t('admin_mailer.new_trends.new_trending_statuses.title') %>
|
||||
|
||||
<% new_trending_statuses.each do |status| %>
|
||||
<%= next unless status.trend.present? %>
|
||||
- <%= ActivityPub::TagManager.instance.url_for(status) %>
|
||||
<%= standard_locale_name(status.language) %> · <%= raw t('admin.trends.tags.current_score', score: status.trend.score.round(2)) %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<%= raw t('admin_mailer.new_trends.new_trending_tags.title') %>
|
||||
|
||||
<% new_trending_tags.each do |tag| %>
|
||||
<%= next unless tag.trend.present? %>
|
||||
- #<%= tag.display_name %>
|
||||
<%= raw t('admin.trends.tags.usage_comparison', today: tag.history.get(Time.now.utc).accounts, yesterday: tag.history.get(Time.now.utc - 1.day).accounts) %> · <%= t('admin.trends.tags.current_score', score: tag.trend.score.round(2)) %>
|
||||
<% end %>
|
||||
|
||||
@@ -16,8 +16,12 @@
|
||||
every: '5m'
|
||||
class: Scheduler::ScheduledStatusesScheduler
|
||||
queue: scheduler
|
||||
trends_refresh_scheduler:
|
||||
every: '5m'
|
||||
trends_refresh_scheduler_1:
|
||||
cron: '10-55/5 */6 * * *'
|
||||
class: Scheduler::Trends::RefreshScheduler
|
||||
queue: scheduler
|
||||
trends_refresh_scheduler_2:
|
||||
cron: '*/5 1,2,3,4,5,7,8,9,10,11,13,14,15,16,17,19,20,21,22,23 * * *'
|
||||
class: Scheduler::Trends::RefreshScheduler
|
||||
queue: scheduler
|
||||
trends_review_notifications_scheduler:
|
||||
|
||||
@@ -98,6 +98,37 @@ RSpec.describe AdminMailer do
|
||||
end
|
||||
end
|
||||
|
||||
describe '.new_trends when between queueing and sending a trend gets deleted' do
|
||||
let(:recipient) { Fabricate(:account, username: 'Snurf') }
|
||||
let(:link) { Fabricate(:preview_card, trendable: true, language: 'en') }
|
||||
let(:status) { Fabricate(:status) }
|
||||
let(:tag) { Fabricate(:tag) }
|
||||
let(:mail) { described_class.with(recipient: recipient).new_trends([link], [tag], [status]).deliver_later! }
|
||||
let(:status_trend) { Fabricate(:status_trend, status: status, account: Fabricate(:account)) }
|
||||
let(:tag_trend) { Fabricate(:tag_trend, tag: tag) }
|
||||
let(:delete_trends) { [TagTrend.delete(tag_trend.id), StatusTrend.delete(status_trend.id)] }
|
||||
let(:create_trends) { [tag_trend, status_trend] }
|
||||
|
||||
before do
|
||||
PreviewCardTrend.create!(preview_card: link)
|
||||
recipient.user.update(locale: :en)
|
||||
end
|
||||
|
||||
it 'sends the email without the respective tag or status or link' do
|
||||
create_trends
|
||||
expect(mail.successfully_enqueued?).to be(true)
|
||||
|
||||
delete_trends
|
||||
expect(mail.perform_now.to).to eq([recipient.user_email])
|
||||
expect(mail.perform_now.subject).to eq(I18n.t('admin_mailer.new_trends.subject', instance: Rails.configuration.x.local_domain))
|
||||
expect(mail.perform_now.from).to eq(['notifications@localhost'])
|
||||
expect(mail.perform_now.body).to have_text(/The following items need a review before they can be displayed publicly/)
|
||||
expect(mail.perform_now.body).to match(link.title)
|
||||
expect(mail.perform_now.body).to_not match(ActivityPub::TagManager.instance.url_for(status))
|
||||
expect(mail.perform_now.body).to_not match(tag.display_name)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.new_software_updates' do
|
||||
let(:recipient) { Fabricate(:account, username: 'Bob') }
|
||||
let(:mail) { described_class.with(recipient: recipient).new_software_updates }
|
||||
|
||||
Reference in New Issue
Block a user