diff --git a/app/views/users/edit_notifications.html.erb b/app/views/users/edit_notifications.html.erb index 9c45445..0976635 100644 --- a/app/views/users/edit_notifications.html.erb +++ b/app/views/users/edit_notifications.html.erb @@ -1,5 +1,11 @@ <% title "Edit Notification Settings: #{@user.name}" %> +<% + def can_edit? + (@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role && current_user.confirmed?) + end +%> + <%= link_to @user.name, @user %> → Edit Notification Settings
All notification emails will be encrypted with this key if you supply it.
- <%= f.text_area :public_key, placeholder: "-----BEGIN PGP PUBLIC KEY BLOCK-----" %> -<%= f.submit "Save changes", class: "btn blue left" %>
+ <%= f.text_area :public_key, placeholder: "-----BEGIN PGP PUBLIC KEY BLOCK-----", disabled: !can_edit? %> +<%= f.submit "Save changes", class: "btn blue left", disabled: !can_edit? %>
+ + <% if !@user.is?(current_user) && !current_user.confirmed? %> + You must confirm your own email before you can edit other user's notification settings. + <% elsif !@user.confirmed? && @user.is?(current_user) %> + You need to confirm your email before you can edit your notification settings. + <% end %> <% end %>