From 044de6a8b5f571a02cdca3bd79dde092afe3eb93 Mon Sep 17 00:00:00 2001 From: Andy Zhao Date: Mon, 19 Nov 2018 19:33:00 -0500 Subject: [PATCH] Make reads controller async and sanitize notification titles (#1158) --- app/labor/notification_counter.rb | 1 - .../_aggregated_reactions.html.erb | 2 +- app/views/notifications/_article.html.erb | 2 +- .../notifications/_badgeachievement.html.erb | 2 +- app/views/notifications/_comment.html.erb | 6 +- app/views/notifications/_reaction.html.erb | 2 +- spec/requests/notifications_spec.rb | 106 ++++++++++-------- 7 files changed, 67 insertions(+), 54 deletions(-) diff --git a/app/labor/notification_counter.rb b/app/labor/notification_counter.rb index 4dfcbfbd1..871bcfe35 100644 --- a/app/labor/notification_counter.rb +++ b/app/labor/notification_counter.rb @@ -11,5 +11,4 @@ class NotificationCounter def set_to_zero @user.notifications.where(read?: false).update_all(read?: true) end - handle_asynchronously :set_to_zero end diff --git a/app/views/notifications/_aggregated_reactions.html.erb b/app/views/notifications/_aggregated_reactions.html.erb index 23ff493b9..0333a18e3 100644 --- a/app/views/notifications/_aggregated_reactions.html.erb +++ b/app/views/notifications/_aggregated_reactions.html.erb @@ -35,7 +35,7 @@ reacted to " class="notification-comment-reacted-link"> <%# your article/comment or the actual title of the article/comment %> - <%= reactable_data["title"].blank? ? "your #{reactable_data["class"]["name"].downcase}" : reactable_data["title"] %> + <%= reactable_data["title"].blank? ? "your #{reactable_data["class"]["name"].downcase}" : sanitize(reactable_data["title"]) %> with diff --git a/app/views/notifications/_article.html.erb b/app/views/notifications/_article.html.erb index 321c77b94..4aba377ad 100644 --- a/app/views/notifications/_article.html.erb +++ b/app/views/notifications/_article.html.erb @@ -15,7 +15,7 @@ ">
- <%= json_data["article"]["title"] %> + <%= sanitize(json_data["article"]["title"]) %>