Add trending statuses (#17431)
* Add trending statuses * Fix dangling items with stale scores in localized sets * Various fixes and improvements - Change approve_all/reject_all to approve_accounts/reject_accounts - Change Trends::Query methods to not mutate the original query - Change Trends::Query#skip to offset - Change follow recommendations to be refreshed in a transaction * Add tests for trending statuses filtering behaviour * Fix not applying filtering scope in controller
This commit is contained in:
parent
a29a982eaa
commit
27965ce5ed
71 changed files with 1074 additions and 307 deletions
14
app/views/admin_mailer/_new_trending_links.text.erb
Normal file
14
app/views/admin_mailer/_new_trending_links.text.erb
Normal file
|
@ -0,0 +1,14 @@
|
|||
<%= raw t('admin_mailer.new_trends.new_trending_links.title') %>
|
||||
|
||||
<% @links.each do |link| %>
|
||||
- <%= link.title %> • <%= link.url %>
|
||||
<%= 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: Trends.links.score(link.id).round(2)) %>
|
||||
<% end %>
|
||||
|
||||
<% if @lowest_trending_link %>
|
||||
<%= raw t('admin_mailer.new_trends.new_trending_links.requirements', lowest_link_title: @lowest_trending_link.title, lowest_link_score: Trends.links.score(@lowest_trending_link.id).round(2), rank: Trends.links.options[:review_threshold]) %>
|
||||
<% else %>
|
||||
<%= raw t('admin_mailer.new_trends.new_trending_links.no_approved_links') %>
|
||||
<% end %>
|
||||
|
||||
<%= raw t('application_mailer.view')%> <%= admin_trends_links_url %>
|
14
app/views/admin_mailer/_new_trending_statuses.text.erb
Normal file
14
app/views/admin_mailer/_new_trending_statuses.text.erb
Normal file
|
@ -0,0 +1,14 @@
|
|||
<%= raw t('admin_mailer.new_trends.new_trending_statuses.title') %>
|
||||
|
||||
<% @statuses.each do |status| %>
|
||||
- <%= ActivityPub::TagManager.instance.url_for(status) %>
|
||||
<%= raw t('admin.trends.tags.current_score', score: Trends.statuses.score(status.id).round(2)) %>
|
||||
<% end %>
|
||||
|
||||
<% if @lowest_trending_status %>
|
||||
<%= raw t('admin_mailer.new_trends.new_trending_statuses.requirements', lowest_status_url: ActivityPub::TagManager.instance.url_for(@lowest_trending_status), lowest_status_score: Trends.statuses.score(@lowest_trending_status.id).round(2), rank: Trends.statuses.options[:review_threshold]) %>
|
||||
<% else %>
|
||||
<%= raw t('admin_mailer.new_trends.new_trending_statuses.no_approved_statuses') %>
|
||||
<% end %>
|
||||
|
||||
<%= raw t('application_mailer.view')%> <%= admin_trends_statuses_url %>
|
14
app/views/admin_mailer/_new_trending_tags.text.erb
Normal file
14
app/views/admin_mailer/_new_trending_tags.text.erb
Normal file
|
@ -0,0 +1,14 @@
|
|||
<%= raw t('admin_mailer.new_trends.new_trending_tags.title') %>
|
||||
|
||||
<% @tags.each do |tag| %>
|
||||
- #<%= tag.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: Trends.tags.score(tag.id).round(2)) %>
|
||||
<% end %>
|
||||
|
||||
<% if @lowest_trending_tag %>
|
||||
<%= raw t('admin_mailer.new_trends.new_trending_tags.requirements', lowest_tag_name: @lowest_trending_tag.name, lowest_tag_score: Trends.tags.score(@lowest_trending_tag.id).round(2), rank: Trends.tags.options[:review_threshold]) %>
|
||||
<% else %>
|
||||
<%= raw t('admin_mailer.new_trends.new_trending_tags.no_approved_tags') %>
|
||||
<% end %>
|
||||
|
||||
<%= raw t('application_mailer.view')%> <%= admin_trends_tags_url(pending_review: '1') %>
|
|
@ -1,16 +0,0 @@
|
|||
<%= raw t('application_mailer.salutation', name: display_name(@me)) %>
|
||||
|
||||
<%= raw t('admin_mailer.new_trending_links.body') %>
|
||||
|
||||
<% @links.each do |link| %>
|
||||
- <%= link.title %> • <%= link.url %>
|
||||
<%= 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: Trends.links.score(link.id).round(2)) %>
|
||||
<% end %>
|
||||
|
||||
<% if @lowest_trending_link %>
|
||||
<%= t('admin_mailer.new_trending_links.requirements', lowest_link_title: @lowest_trending_link.title, lowest_link_score: Trends.links.score(@lowest_trending_link.id).round(2)) %>
|
||||
<% else %>
|
||||
<%= t('admin_mailer.new_trending_links.no_approved_links') %>
|
||||
<% end %>
|
||||
|
||||
<%= raw t('application_mailer.view')%> <%= admin_trends_links_url %>
|
|
@ -1,16 +0,0 @@
|
|||
<%= raw t('application_mailer.salutation', name: display_name(@me)) %>
|
||||
|
||||
<%= raw t('admin_mailer.new_trending_tags.body') %>
|
||||
|
||||
<% @tags.each do |tag| %>
|
||||
- #<%= tag.name %>
|
||||
<%= 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: Trends.tags.score(tag.id).round(2)) %>
|
||||
<% end %>
|
||||
|
||||
<% if @lowest_trending_tag %>
|
||||
<%= t('admin_mailer.new_trending_tags.requirements', lowest_tag_name: @lowest_trending_tag.name, lowest_tag_score: Trends.tags.score(@lowest_trending_tag.id).round(2)) %>
|
||||
<% else %>
|
||||
<%= t('admin_mailer.new_trending_tags.no_approved_tags') %>
|
||||
<% end %>
|
||||
|
||||
<%= raw t('application_mailer.view')%> <%= admin_trends_tags_url(status: 'pending_review') %>
|
13
app/views/admin_mailer/new_trends.text.erb
Normal file
13
app/views/admin_mailer/new_trends.text.erb
Normal file
|
@ -0,0 +1,13 @@
|
|||
<%= raw t('application_mailer.salutation', name: display_name(@me)) %>
|
||||
|
||||
<%= raw t('admin_mailer.new_trends.body') %>
|
||||
|
||||
<% unless @links.empty? %>
|
||||
<%= render 'new_trending_links' %>
|
||||
<% end %>
|
||||
<% unless @tags.empty? %>
|
||||
<%= render 'new_trending_tags' unless @tags.empty? %>
|
||||
<% end %>
|
||||
<% unless @statuses.empty? %>
|
||||
<%= render 'new_trending_statuses' unless @statuses.empty? %>
|
||||
<% end %>
|
Loading…
Add table
Add a link
Reference in a new issue