Improve permission list in RS emails
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 3s

This commit is contained in:
Râu Cao 2023-11-20 18:32:52 +01:00
parent cfd0935bdc
commit aab6793b86
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
2 changed files with 7 additions and 2 deletions

View File

@ -9,6 +9,11 @@ class NotificationMailer < ApplicationMailer
def remotestorage_auth_created def remotestorage_auth_created
@user = params[:user] @user = params[:user]
@auth = params[:auth] @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" @subject = "New app connected to your storage"
mail to: @user.email, subject: @subject mail to: @user.email, subject: @subject
end end

View File

@ -15,9 +15,9 @@ Have fun!
--- ---
You can disable email notifications for new app authorizations in your account settings: You can disable email notifications for new app authorizations in your account settings:
<%= setting_path(:remotestorage) %> <%= setting_url(:remotestorage) %>
<% if Setting.discourse_enabled %> <% if Setting.discourse_enabled %>
If you have any questions, please visit our community forums: If you have any questions, please visit our community forums:
<%= Setting.discourse_public_url %> <%= Setting.discourse_public_url %>
<% end %> <% end %>