Add reminder job interval option

This commit is contained in:
Martin Artnik 2023-12-12 14:08:42 +01:00
parent c599c939b8
commit 0344860827
3 changed files with 10 additions and 2 deletions

View file

@ -22,6 +22,7 @@ class UserNotificationsController < ApplicationController
def load_notifications
current_user.notifications
.in_app
.order(created_at: :desc)
end

View file

@ -1,10 +1,12 @@
# frozen_string_literal: true
class Notification < ApplicationRecord
include Noticed::Model
belongs_to :recipient, polymorphic: true
scope :in_app, -> { where.not("notifications.params->'hide_in_app' = 'true'") }
private
def can_send_to_user?(_user)

View file

@ -35,7 +35,12 @@ class BaseNotification < Noticed::Base
private
def database_notification?
recipient.notifications_settings.dig(notification_subgroup.to_s, 'in_app')
# always save all notifications,
# but flag if they should display in app or not
params[:hide_in_app] = recipient.notifications_settings.dig(notification_subgroup.to_s, 'in_app') != true
true
end
def email_notification?