about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorsternenseemann <git@lukasepple.de>2020-04-20 14:03:03 +0200
committerGitHub <noreply@github.com>2020-04-20 14:03:03 +0200
commit679980f77c0e869d2eebbf64c18faabd8a523a13 (patch)
treec160b40a94b74c16c6c68d9ff2c7db39ae35596b /app/helpers
parent29f5353f8b7af331d6dddea4ee1888913361a545 (diff)
Allow users to delete their header and avatar (#13234)
This is achieved by sending a DELETE request to
/settings/profile/pictures/{avatar,header} via a link that is part of
the upload form's hint of the respective picture.
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/settings_helper.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index 825aa974d..74544bad9 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -105,4 +105,13 @@ module SettingsHelper
       safe_join([image_tag(account.avatar.url, width: 15, height: 15, alt: display_name(account), class: 'avatar'), content_tag(:span, account.acct, class: 'username')], ' ')
     end
   end
+
+  def picture_hint(hint, picture)
+    if picture.original_filename.nil?
+      hint
+    else
+      link = link_to t('generic.delete'), settings_profile_picture_path(picture.name.to_s), data: { method: :delete }
+      safe_join([hint, link], '<br/>'.html_safe)
+    end
+  end
 end