parent
739a4f9068
commit
0cb5a2a0a7
@ -1,5 +1,5 @@
|
||||
<%= yield %>
|
||||
|
||||
---
|
||||
|
||||
<%= t('application_mailer.signature', instance: Rails.configuration.x.local_domain) %>
|
||||
<%= t('application_mailer.settings', link: settings_preferences_url) %>
|
||||
|
@ -1,3 +1,3 @@
|
||||
<%= strip_tags(@status.content) %>
|
||||
<%= raw Formatter.instance.plaintext(status) %>
|
||||
|
||||
<%= web_url("statuses/#{@status.id}") %>
|
||||
<%= raw t('application_mailer.view')%> <%= web_url("statuses/#{status.id}") %>
|
||||
|
@ -0,0 +1,15 @@
|
||||
<%= display_name(@me) %>,
|
||||
|
||||
<%= raw t('notification_mailer.digest.body', since: @since, instance: root_url) %>
|
||||
<% @notifications.each do |notification| %>
|
||||
|
||||
* <%= raw t('notification_mailer.digest.mention', name: notification.from_account.acct) %>
|
||||
|
||||
<%= raw Formatter.instance.plaintext(notification.target_status) %>
|
||||
|
||||
<%= raw t('application_mailer.view')%> <%= web_url("statuses/#{notification.target_status.id}") %>
|
||||
<% end %>
|
||||
<% if @follows_since > 0 %>
|
||||
|
||||
<%= raw t('notification_mailer.digest.new_followers_summary', count: @follows_since) %>
|
||||
<% end %>
|
@ -1,5 +1,5 @@
|
||||
<%= display_name(@me) %>,
|
||||
|
||||
<%= t('notification_mailer.favourite.body', name: @account.acct) %>
|
||||
<%= raw t('notification_mailer.favourite.body', name: @account.acct) %>
|
||||
|
||||
<%= render partial: 'status' %>
|
||||
<%= render partial: 'status', locals: { status: @status } %>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<%= display_name(@me) %>,
|
||||
|
||||
<%= t('notification_mailer.follow.body', name: @account.acct) %>
|
||||
<%= raw t('notification_mailer.follow.body', name: @account.acct) %>
|
||||
|
||||
<%= web_url("accounts/#{@account.id}") %>
|
||||
<%= raw t('application_mailer.view')%> <%= web_url("accounts/#{@account.id}") %>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<%= display_name(@me) %>,
|
||||
|
||||
<%= t('notification_mailer.follow_request.body', name: @account.acct) %>
|
||||
<%= raw t('notification_mailer.follow_request.body', name: @account.acct) %>
|
||||
|
||||
<%= web_url("follow_requests") %>
|
||||
<%= raw t('application_mailer.view')%> <%= web_url("follow_requests") %>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<%= display_name(@me) %>,
|
||||
|
||||
<%= t('notification_mailer.mention.body', name: @status.account.acct) %>
|
||||
<%= raw t('notification_mailer.mention.body', name: @status.account.acct) %>
|
||||
|
||||
<%= render partial: 'status' %>
|
||||
<%= render partial: 'status', locals: { status: @status } %>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<%= display_name(@me) %>,
|
||||
|
||||
<%= t('notification_mailer.reblog.body', name: @account.acct) %>
|
||||
<%= raw t('notification_mailer.reblog.body', name: @account.acct) %>
|
||||
|
||||
<%= render partial: 'status' %>
|
||||
<%= render partial: 'status', locals: { status: @status } %>
|
||||
|
@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DigestMailerWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
sidekiq_options queue: 'mailers'
|
||||
|
||||
def perform(user_id)
|
||||
user = User.find(user_id)
|
||||
return unless user.settings.notification_emails['digest']
|
||||
NotificationMailer.digest(user.account).deliver_now!
|
||||
user.touch(:last_emailed_at)
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class AddLastEmailedAtToUsers < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :users, :last_emailed_at, :datetime, null: true, default: nil
|
||||
end
|
||||
end
|
@ -1,24 +1,31 @@
|
||||
# Preview all emails at http://localhost:3000/rails/mailers/notification_mailer
|
||||
class NotificationMailerPreview < ActionMailer::Preview
|
||||
|
||||
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/mention
|
||||
def mention
|
||||
# NotificationMailer.mention
|
||||
m = Mention.last
|
||||
NotificationMailer.mention(m.account, Notification.find_by(activity: m))
|
||||
end
|
||||
|
||||
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/follow
|
||||
def follow
|
||||
# NotificationMailer.follow
|
||||
f = Follow.last
|
||||
NotificationMailer.follow(f.target_account, Notification.find_by(activity: f))
|
||||
end
|
||||
|
||||
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/favourite
|
||||
def favourite
|
||||
# NotificationMailer.favourite
|
||||
f = Favourite.last
|
||||
NotificationMailer.favourite(f.status.account, Notification.find_by(activity: f))
|
||||
end
|
||||
|
||||
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/reblog
|
||||
def reblog
|
||||
# NotificationMailer.reblog
|
||||
r = Status.where.not(reblog_of_id: nil).first
|
||||
NotificationMailer.reblog(r.reblog.account, Notification.find_by(activity: r))
|
||||
end
|
||||
|
||||
# Preview this email at http://localhost:3000/rails/mailers/notification_mailer/digest
|
||||
def digest
|
||||
NotificationMailer.digest(Account.first, since: 90.days.ago)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in new issue