Prevent links from notifications from being opened in the dropdown frame

This commit is contained in:
Karina Kwiatek 2023-05-09 22:51:40 +02:00
parent 603a454efd
commit e096ddc999
7 changed files with 12 additions and 12 deletions

View File

@ -12,7 +12,7 @@ module UserHelper
if url if url
return user_path(user) if link_only return user_path(user) if link_only
return profile_link(user) return profile_link(user, "_top")
end end
user.profile.safe_name.strip user.profile.safe_name.strip
end end
@ -23,8 +23,8 @@ module UserHelper
private private
def profile_link(user) def profile_link(user, target = nil)
link_to(user.profile.safe_name, user_path(user), class: ("user--banned" if user.banned?).to_s) link_to(user.profile.safe_name, user_path(user), class: ("user--banned" if user.banned?).to_s, target:)
end end
def should_unmask?(author_identifier) def should_unmask?(author_identifier)

View File

@ -6,7 +6,7 @@
%img.avatar-xs{ src: notification.target.user.profile_picture.url(:small), loading: :lazy } %img.avatar-xs{ src: notification.target.user.profile_picture.url(:small), loading: :lazy }
= t(".heading_html", = t(".heading_html",
user: user_screen_name(notification.target.user), user: user_screen_name(notification.target.user),
question: link_to(t(".link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.id)), question: link_to(t(".link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.id), target: "_top"),
time: time_tooltip(notification.target)) time: time_tooltip(notification.target))
.list-group .list-group
.list-group-item .list-group-item

View File

@ -7,17 +7,17 @@
- if notification.target.answer.user == current_user - if notification.target.answer.user == current_user
= t(".heading_html", = t(".heading_html",
user: user_screen_name(notification.target.user), user: user_screen_name(notification.target.user),
answer: link_to(t(".active.link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)), answer: link_to(t(".active.link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), target: "_top"),
time: time_tooltip(notification.target)) time: time_tooltip(notification.target))
- elsif notification.target.user == notification.target.answer.user - elsif notification.target.user == notification.target.answer.user
= t(".heading_html", = t(".heading_html",
user: user_screen_name(notification.target.user), user: user_screen_name(notification.target.user),
answer: link_to(t(".passive.link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)), answer: link_to(t(".passive.link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), target: "_top"),
time: time_tooltip(notification.target)) time: time_tooltip(notification.target))
- else - else
= t(".heading_html", = t(".heading_html",
user: user_screen_name(notification.target.user), user: user_screen_name(notification.target.user),
answer: link_to(t(".other.link_text_html", user: user_screen_name(notification.target.answer.user, url: false)), answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id)), answer: link_to(t(".other.link_text_html", user: user_screen_name(notification.target.answer.user, url: false)), answer_path(username: notification.target.user.screen_name, id: notification.target.answer.id), target: "_top"),
time: time_tooltip(notification.target)) time: time_tooltip(notification.target))
.list-group .list-group
.list-group-item .list-group-item

View File

@ -5,4 +5,4 @@
%h6.notification__user %h6.notification__user
= t(".heading") = t(".heading")
.notification__text .notification__text
= t(".text_html", settings_export: link_to(t(".settings_export"), settings_export_path)) = t(".text_html", settings_export: link_to(t(".settings_export"), settings_export_path, target: "_top"))

View File

@ -5,4 +5,4 @@
%h6.notification__user %h6.notification__user
= user_screen_name notification.target.source = user_screen_name notification.target.source
.notification__text .notification__text
= t(".heading_html", time: time_ago_in_words(notification.target.created_at)) = t(".heading_html", time: time_ago_in_words(notification.target.created_at), target: "_top")

View File

@ -7,12 +7,12 @@
- if notification.target.parent_type == 'Answer' - if notification.target.parent_type == 'Answer'
= t(".heading_html", = t(".heading_html",
user: user_screen_name(notification.target.user), user: user_screen_name(notification.target.user),
type: link_to(t(".#{notification.target.parent_type.downcase}.link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.parent.id)), type: link_to(t(".#{notification.target.parent_type.downcase}.link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.parent.id), target: "_top"),
time: time_tooltip(notification.target)) time: time_tooltip(notification.target))
- elsif notification.target.parent_type == 'Comment' - elsif notification.target.parent_type == 'Comment'
= t(".heading_html", = t(".heading_html",
user: user_screen_name(notification.target.user), user: user_screen_name(notification.target.user),
type: link_to(t(".#{notification.target.parent_type.downcase}.link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.parent.answer.id)), type: link_to(t(".#{notification.target.parent_type.downcase}.link_text"), answer_path(username: notification.target.user.screen_name, id: notification.target.parent.answer.id), target: "_top"),
time: time_tooltip(notification.target)) time: time_tooltip(notification.target))
.list-group .list-group
.list-group-item .list-group-item

View File

@ -7,4 +7,4 @@
%h6.notification__user %h6.notification__user
= t(".heading") = t(".heading")
.notification__text .notification__text
= t(".text_html", settings_push: link_to(t(".settings_push"), settings_push_notifications_path)) = t(".text_html", settings_push: link_to(t(".settings_push"), settings_push_notifications_path, target: "_top"))