mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 17:31:12 +00:00
Move lengthy ruby logic from mailer view to helper (#35911)
This commit is contained in:
parent
35a06319fa
commit
5cb7dfafcc
|
@ -243,6 +243,10 @@ module ApplicationHelper
|
||||||
tag.input(type: :text, maxlength: 999, spellcheck: false, readonly: true, **options)
|
tag.input(type: :text, maxlength: 999, spellcheck: false, readonly: true, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def recent_tag_users(tag)
|
||||||
|
tag.statuses.public_visibility.joins(:account).merge(Account.without_suspended.without_silenced).includes(:account).limit(3).map(&:account)
|
||||||
|
end
|
||||||
|
|
||||||
def recent_tag_usage(tag)
|
def recent_tag_usage(tag)
|
||||||
people = tag.history.aggregate(2.days.ago.to_date..Time.zone.today).accounts
|
people = tag.history.aggregate(2.days.ago.to_date..Time.zone.today).accounts
|
||||||
I18n.t 'user_mailer.welcome.hashtags_recent_count', people: number_with_delimiter(people), count: people
|
I18n.t 'user_mailer.welcome.hashtags_recent_count', people: number_with_delimiter(people), count: people
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
- accounts = hashtag.statuses.public_visibility.joins(:account).merge(Account.without_suspended.without_silenced).includes(:account).limit(3).map(&:account)
|
|
||||||
|
|
||||||
%table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' }
|
%table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' }
|
||||||
%tr
|
%tr
|
||||||
%td.email-mini-wrapper-td
|
%td.email-mini-wrapper-td
|
||||||
|
@ -13,7 +11,7 @@
|
||||||
%table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' }
|
%table.email-w-full{ cellspacing: 0, cellpadding: 0, border: 0, role: 'presentation' }
|
||||||
%tr
|
%tr
|
||||||
%td.email-mini-hashtag-img-td
|
%td.email-mini-hashtag-img-td
|
||||||
- accounts.each do |account|
|
- recent_tag_users(hashtag).each do |account|
|
||||||
%span.email-mini-hashtag-img-span
|
%span.email-mini-hashtag-img-span
|
||||||
= image_tag full_asset_url(account.avatar.url), alt: '', width: 16, height: 16
|
= image_tag full_asset_url(account.avatar.url), alt: '', width: 16, height: 16
|
||||||
%td
|
%td
|
||||||
|
|
Loading…
Reference in New Issue
Block a user