From 80d8bebe5735b37c23810004da917f7d4f6c9e5e Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Fri, 10 Mar 2023 21:08:28 +0100 Subject: [PATCH] Appease the dog overlords --- app/controllers/notifications_controller.rb | 4 +-- app/views/navigation/_desktop.html.haml | 2 +- .../dropdown/_notifications.html.haml | 35 +++++++++---------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index f1c885f4..8338047f 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -26,12 +26,12 @@ class NotificationsController < ApplicationController end def read - current_user.notifications.where(new: true).update_all(new: false) + current_user.notifications.where(new: true).update_all(new: false) # rubocop:disable Rails/SkipsModelValidations respond_to do |format| format.turbo_stream do render "navigation/notifications", locals: { notifications: [], notification_count: nil } - end + end end end diff --git a/app/views/navigation/_desktop.html.haml b/app/views/navigation/_desktop.html.haml index d709cf4f..93a6a027 100644 --- a/app/views/navigation/_desktop.html.haml +++ b/app/views/navigation/_desktop.html.haml @@ -31,7 +31,7 @@ %span.badge= notification_count .dropdown-menu.dropdown-menu-end.notification-dropdown %turbo-frame#notifications-dropdown-list - = render 'navigation/dropdown/notifications', notifications:, notification_count: nil + = render "navigation/dropdown/notifications", notifications:, notification_count: nil %li.nav-item.d-none.d-sm-block{ data: { bs_toggle: 'tooltip', bs_placement: 'bottom' }, title: t('.ask_question') } %a.nav-link{ href: "#", name: "toggle-all-ask", data: { bs_target: "#modal-ask-followers", bs_toggle: :modal, hotkey: "n" } } %i.fa.fa-pencil-square-o diff --git a/app/views/navigation/dropdown/_notifications.html.haml b/app/views/navigation/dropdown/_notifications.html.haml index 613cafea..b95fbb63 100644 --- a/app/views/navigation/dropdown/_notifications.html.haml +++ b/app/views/navigation/dropdown/_notifications.html.haml @@ -1,19 +1,18 @@ -.dropdown-menu.dropdown-menu-end.notification-dropdown{ id: "rs-#{size}-nav-notifications" } - - if notifications.count.zero? - %a.dropdown-item.text-center{ href: notifications_path('all') } - %i.fa.fa-fw.fa-chevron-right - = t(".all") - .dropdown-item.text-center.p-2 - %i.fa.fa-bell-o.notification__bell-icon - %p= t(".none") - - else - %a.dropdown-item.text-center{ href: notifications_path } - %i.fa.fa-fw.fa-chevron-right - = t(".new") - = link_to notifications_read_path, class: "dropdown-item text-center", data: { turbo_stream: true, turbo_method: :post } do - %i.fa.fa-fw.fa-check-double - = t(".mark_as_read") - - notifications.each do |notification| - .dropdown-item - = render "notifications/type/#{notification.target.class.name.downcase.split('::').last}", notification: notification +- if notifications.count.zero? + %a.dropdown-item.text-center{ href: notifications_path('all') } + %i.fa.fa-fw.fa-chevron-right + = t(".all") + .dropdown-item.text-center.p-2 + %i.fa.fa-bell-o.notification__bell-icon + %p= t(".none") +- else + %a.dropdown-item.text-center{ href: notifications_path } + %i.fa.fa-fw.fa-chevron-right + = t(".new") + = link_to notifications_read_path, class: "dropdown-item text-center", data: { turbo_stream: true, turbo_method: :post } do + %i.fa.fa-fw.fa-check-double + = t(".mark_as_read") + - notifications.each do |notification| + .dropdown-item + = render "notifications/type/#{notification.target.class.name.downcase.split('::').last}", notification: