]> git.openstreetmap.org Git - rails.git/commitdiff
Adds helper routine note_description
authorNenad Vujicic <nenadus@gmail.com>
Thu, 23 Jan 2025 15:16:51 +0000 (16:16 +0100)
committerNenad Vujicic <nenadus@gmail.com>
Tue, 4 Feb 2025 00:22:28 +0000 (01:22 +0100)
Adds new helper routine note_description for retrieving note's description. Helper routine returns "deleted" if author is deleted otherwise note's description.

app/helpers/note_helper.rb
config/locales/en.yml

index 2e9850aef060f2b6549de5cdecac599d95fbdd9a..0ba5032288b7c7b7ebb9803a00fc230506372775 100644 (file)
@@ -1,6 +1,14 @@
 module NoteHelper
   include ActionView::Helpers::TranslationHelper
 
 module NoteHelper
   include ActionView::Helpers::TranslationHelper
 
+  def note_description(author, description)
+    if !author.nil? && author.status == "deleted"
+      RichText.new("text", t("notes.show.description_when_author_is_deleted"))
+    else
+      description
+    end
+  end
+
   def note_event(event, at, by)
     if by.nil?
       t("notes.show.event_#{event}_by_anonymous_html",
   def note_event(event, at, by)
     if by.nil?
       t("notes.show.event_#{event}_by_anonymous_html",
index 172c6618232aedb1927e280e0cc55cd504e0aa18..ac3e029e3db5daa7ad5c53609a1beca33cdfa9c7 100644 (file)
@@ -3069,6 +3069,7 @@ en:
       open_title: "Unresolved note #%{note_name}"
       closed_title: "Resolved note #%{note_name}"
       hidden_title: "Hidden note #%{note_name}"
       open_title: "Unresolved note #%{note_name}"
       closed_title: "Resolved note #%{note_name}"
       hidden_title: "Hidden note #%{note_name}"
+      description_when_author_is_deleted: "deleted"
       event_opened_by_html: "Created by %{user} %{time_ago}"
       event_opened_by_anonymous_html: "Created by anonymous %{time_ago}"
       event_commented_by_html: "Comment from %{user} %{time_ago}"
       event_opened_by_html: "Created by %{user} %{time_ago}"
       event_opened_by_anonymous_html: "Created by anonymous %{time_ago}"
       event_commented_by_html: "Comment from %{user} %{time_ago}"