Add invite request to pending account notification e-mail (#10528)
Fix sorting of the pending accounts page
This commit is contained in:
		
							parent
							
								
									36b39fbac5
								
							
						
					
					
						commit
						46cb36fd2c
					
				
					 4 changed files with 21 additions and 4 deletions
				
			
		| 
						 | 
					@ -30,7 +30,7 @@ module Admin
 | 
				
			||||||
    private
 | 
					    private
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def set_accounts
 | 
					    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
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def form_account_batch_params
 | 
					    def form_account_batch_params
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,4 +117,9 @@ module ApplicationHelper
 | 
				
			||||||
  def storage_host?
 | 
					  def storage_host?
 | 
				
			||||||
    ENV['S3_ALIAS_HOST'].present? || ENV['S3_CLOUDFRONT_HOST'].present?
 | 
					    ENV['S3_ALIAS_HOST'].present? || ENV['S3_CLOUDFRONT_HOST'].present?
 | 
				
			||||||
  end
 | 
					  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
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<%= raw t('admin_mailer.new_pending_account.body') %>
 | 
					<%= raw t('admin_mailer.new_pending_account.body') %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<%= raw t('admin.accounts.email') %>: <%= @account.user_email %>
 | 
					<%= @account.user_email %> (@<%= @account.username %>)
 | 
				
			||||||
<%= raw t('admin.accounts.most_recent_ip') %>: <%= @account.user_current_sign_in_ip %>
 | 
					<%= @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 %>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										8
									
								
								spec/mailers/previews/admin_mailer_preview.rb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								spec/mailers/previews/admin_mailer_preview.rb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					# Preview all emails at http://localhost:3000/rails/mailers/admin_mailer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class AdminMailerPreview < ActionMailer::Preview
 | 
				
			||||||
 | 
					  # Preview this email at http://localhost:3000/rails/mailers/admin_mailer/new_pending_account
 | 
				
			||||||
 | 
					  def new_pending_account
 | 
				
			||||||
 | 
					    AdminMailer.new_pending_account(Account.first, User.pending.first)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue