class NotificationMailer < ApplicationMailer def lightning_sats_received @user = params[:user] @amount_sats = params[:amount_sats] @subject = "Sats received" mail to: @user.email, subject: @subject end def remotestorage_auth_created @user = params[:user] @auth = params[:auth] @permissions = @auth.permissions.map do |p| access = p.split(":")[1] == 'r' ? 'read' : 'read/write' directory = p.split(':')[0] == '' ? 'all folders and files' : p.split(':')[0] "#{access} #{directory}" end @subject = "New app connected to your storage" mail to: @user.email, subject: @subject end end