about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-04-10 00:36:01 +0200
committerGitHub <noreply@github.com>2019-04-10 00:36:01 +0200
commit46cb36fd2cc641ab6c125f7e91140fa1b1d77634 (patch)
tree3e659d684e3c8ee8b9c592b59310bfd0c2c43e18 /app
parent36b39fbac55a9b141b99b54f193ec2702f8c3c39 (diff)
Add invite request to pending account notification e-mail (#10528)
Fix sorting of the pending accounts page
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/pending_accounts_controller.rb2
-rw-r--r--app/helpers/application_helper.rb5
-rw-r--r--app/views/admin_mailer/new_pending_account.text.erb10
3 files changed, 13 insertions, 4 deletions
diff --git a/app/controllers/admin/pending_accounts_controller.rb b/app/controllers/admin/pending_accounts_controller.rb
index 249525504..b62a9bc84 100644
--- a/app/controllers/admin/pending_accounts_controller.rb
+++ b/app/controllers/admin/pending_accounts_controller.rb
@@ -30,7 +30,7 @@ module Admin
     private
 
     def set_accounts
-      @accounts = Account.joins(:user).merge(User.pending).includes(user: :invite_request).page(params[:page])
+      @accounts = Account.joins(:user).merge(User.pending.recent).includes(user: :invite_request).page(params[:page])
     end
 
     def form_account_batch_params
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index b42b1bbdf..9d113263d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -117,4 +117,9 @@ module ApplicationHelper
   def storage_host?
     ENV['S3_ALIAS_HOST'].present? || ENV['S3_CLOUDFRONT_HOST'].present?
   end
+
+  def quote_wrap(text, line_width: 80, break_sequence: "\n")
+    text = word_wrap(text, line_width: line_width - 2, break_sequence: break_sequence)
+    text.split("\n").map { |line| '> ' + line }.join("\n")
+  end
 end
diff --git a/app/views/admin_mailer/new_pending_account.text.erb b/app/views/admin_mailer/new_pending_account.text.erb
index ed31ae2eb..a466ee2de 100644
--- a/app/views/admin_mailer/new_pending_account.text.erb
+++ b/app/views/admin_mailer/new_pending_account.text.erb
@@ -2,7 +2,11 @@
 
 <%= raw t('admin_mailer.new_pending_account.body') %>
 
-<%= raw t('admin.accounts.email') %>: <%= @account.user_email %>
-<%= raw t('admin.accounts.most_recent_ip') %>: <%= @account.user_current_sign_in_ip %>
+<%= @account.user_email %> (@<%= @account.username %>)
+<%= @account.user_current_sign_in_ip %>
+<% if @account.user&.invite_request&.text.present? %>
 
-<%= raw t('application_mailer.view')%> <%= admin_account_url(@account.id) %>
+<%= quote_wrap(@account.user&.invite_request&.text) %>
+<% end %>
+
+<%= raw t('application_mailer.view')%> <%= admin_pending_accounts_url %>