2
0

Move lengthy ruby logic from mailer view to helper (#35911)

This commit is contained in:
Matt Jankowski
2025-08-27 09:15:33 -04:00
committed by GitHub
parent 35a06319fa
commit 5cb7dfafcc
2 changed files with 5 additions and 3 deletions

View File

@@ -243,6 +243,10 @@ module ApplicationHelper
tag.input(type: :text, maxlength: 999, spellcheck: false, readonly: true, **options)
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)
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