* Add MVP of notification subscriptions * Add rate limiting for notification subscriptions * Show modal for logged out users on subscribe click * Add enter key functionality for checkbox * Add relationships for notification subscriptions * Add model test for notification subscription * Deprecated article mutes in favor of notification subscriptions * Deprecated comment mutes in favor of notification subscriptions * Move comment muting tests and logic over * Merge comment and article muting into subscriptions * Remove redundant check * Use database to check for rate limit instead of cache * Test for subscriptions handling notifications properly * Fix notification model spec for subscriptions * Fix tests for subscriptions * Remove rate limiting * Properly handle logged out users getting subscription status * Fix test for new pattern * Update reserved words * Add config column to notification subscriptions * Add logic for top level config and move tests * Test for top level subscribers getting notified * Fix logic mistake oops * Add index and refactor comment_user_ids
7 lines
342 B
Ruby
7 lines
342 B
Ruby
class NotificationSubscription < ApplicationRecord
|
|
belongs_to :user
|
|
belongs_to :notifiable, polymorphic: true
|
|
validates :notifiable_type, inclusion: { in: %w[Comment Article] }
|
|
validates :user_id, uniqueness: { scope: %i[notifiable_type notifiable_id] }
|
|
validates :config, inclusion: { in: %w[all_comments top_level_comments] }
|
|
end
|