mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 09:23:58 +08:00
Add reminder job interval option
This commit is contained in:
parent
c599c939b8
commit
0344860827
3 changed files with 10 additions and 2 deletions
|
@ -22,6 +22,7 @@ class UserNotificationsController < ApplicationController
|
|||
|
||||
def load_notifications
|
||||
current_user.notifications
|
||||
.in_app
|
||||
.order(created_at: :desc)
|
||||
end
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue