Appease the dog overlords

This commit is contained in:
Karina Kwiatek 2023-03-10 21:08:28 +01:00
parent c9c458252b
commit 80d8bebe57
3 changed files with 20 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -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: