From: Nenad Vujicic Date: Thu, 23 Jan 2025 15:16:51 +0000 (+0100) Subject: Adds helper routine note_description X-Git-Tag: live~168^2~3 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/a6d7c772e55e55d83ee696db0db9f3e41ac3116f Adds helper routine note_description Adds new helper routine note_description for retrieving note's description. Helper routine returns "deleted" if author is deleted otherwise note's description. --- diff --git a/app/helpers/note_helper.rb b/app/helpers/note_helper.rb index 2e9850aef..0ba503228 100644 --- a/app/helpers/note_helper.rb +++ b/app/helpers/note_helper.rb @@ -1,6 +1,14 @@ 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", diff --git a/config/locales/en.yml b/config/locales/en.yml index 172c66182..ac3e029e3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3069,6 +3069,7 @@ en: 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}"