From b3f15fe40924c17cadca86e22496b5261838eb69 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Thu, 7 Jul 2022 08:12:56 +0200 Subject: [PATCH] Remove unnecessary duplicate locales --- app/views/notifications/type/_comment.haml | 6 +++--- app/views/notifications/type/_reaction.haml | 4 ++-- config/locales/views.en.yml | 9 ++------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/views/notifications/type/_comment.haml b/app/views/notifications/type/_comment.haml index f678e2b8..a8117e15 100644 --- a/app/views/notifications/type/_comment.haml +++ b/app/views/notifications/type/_comment.haml @@ -5,17 +5,17 @@ .notification__heading %img.avatar-xs{ src: notification.target.user.profile_picture.url(:small) } - if notification.target.answer.user == current_user - = t(".active.heading_html", + = t(".heading_html", user: user_screen_name(notification.target.user), answer: link_to(t(".active.link_text"), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)), time: time_tooltip(notification.target)) - elsif notification.target.user == notification.target.answer.user - = t(".passive.heading_html", + = t(".heading_html", user: user_screen_name(notification.target.user), answer: link_to(t(".passive.link_text"), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)), time: time_tooltip(notification.target)) - else - = t(".other.heading_html", + = t(".heading_html", user: user_screen_name(notification.target.user), answer: link_to(t(".other.link_text", user: user_screen_name(notification.target.answer.user)), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)), time: time_tooltip(notification.target)) diff --git a/app/views/notifications/type/_reaction.haml b/app/views/notifications/type/_reaction.haml index 4a08d8f7..e28f0d8b 100644 --- a/app/views/notifications/type/_reaction.haml +++ b/app/views/notifications/type/_reaction.haml @@ -5,12 +5,12 @@ .notification__heading %img.avatar-xs{ src: notification.target.user.profile_picture.url(:small) } - if notification.target.parent_type == 'Answer' - = t(".#{notification.target.parent_type.downcase}.heading_html", + = t(".heading_html", user: user_screen_name(notification.target.user), type: link_to(t(".#{notification.target.parent_type.downcase}.link_text"), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.parent.id)), time: time_tooltip(notification.target)) - elsif notification.target.parent_type == 'Comment' - = t(".#{notification.target.parent_type.downcase}.heading_html", + = t(".heading_html", user: user_screen_name(notification.target.user), type: link_to(t(".#{notification.target.parent_type.downcase}.link_text"), show_user_answer_path(username: notification.target.user.screen_name, id: notification.target.parent.answer.id)), time: time_tooltip(notification.target)) diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index b343e8f2..6c8973b7 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -118,23 +118,18 @@ en: heading_html: "%{user} answered %{question} %{time} ago" link_text: "your question" comment: - heading: "%{user} commented on %{answer} %{time} ago" + heading_html: "%{user} commented on %{answer} %{time} ago" active: - heading_html: :notifications.type.comment.heading link_text: "your answer" passive: - heading_html: :notifications.type.comment.heading link_text: "their answer" other: - heading_html: :notifications.type.comment.heading link_text: "%{user}'s answer" reaction: - heading: "%{user} smiled %{type} %{time} ago" + heading_html: "%{user} smiled %{type} %{time} ago" answer: - heading_html: :notifications.type.reaction.heading link_text: "your answer" comment: - heading_html: :notifications.type.reaction.heading link_text: "your comment" follow: heading_html: "followed you %{time} ago"