From aab6793b868112f67db49f494e759a9e6be214da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Mon, 20 Nov 2023 18:32:52 +0100 Subject: [PATCH] Improve permission list in RS emails --- app/mailers/notification_mailer.rb | 5 +++++ .../notification_mailer/remotestorage_auth_created.text.erb | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 19fc8ec..81132b9 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -9,6 +9,11 @@ class NotificationMailer < ApplicationMailer 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 diff --git a/app/views/notification_mailer/remotestorage_auth_created.text.erb b/app/views/notification_mailer/remotestorage_auth_created.text.erb index cc8cd31..61338f3 100644 --- a/app/views/notification_mailer/remotestorage_auth_created.text.erb +++ b/app/views/notification_mailer/remotestorage_auth_created.text.erb @@ -15,9 +15,9 @@ Have fun! --- You can disable email notifications for new app authorizations in your account settings: -<%= setting_path(:remotestorage) %> - +<%= setting_url(:remotestorage) %> <% if Setting.discourse_enabled %> + If you have any questions, please visit our community forums: <%= Setting.discourse_public_url %> <% end %>