* feat: add the two new models users_setting and users_notification_setting * feat: add the settings and notification_settings table to the schema * feat: add the user and notification models * feat: add the user_id foreign key to the model * chore: sneaky indent * feat: add some fields from the profile attributes * Revert "feat: add some fields from the profile attributes" This reverts commit 376828746ded063a243505d317140fa5339227cf. * chore: add some profile field attributes * chore: remove language_settings * chore: update indent * chore: remove language_settings * feat: changes to the tables * chore: remove validation in favor of the foreign keys * chore: add default for editor version * Address PR review suggestions * setting_spec.rb needs to be fixed; need help * Working on PR review comments * Continue with addressing PR review comments * Remove normalize_config_values method; pass correct values from forms * Address Travis failures * revert some unnecessary changes in spec file Co-authored-by: Arit Amana <msarit@gmail.com>
14 lines
654 B
Ruby
14 lines
654 B
Ruby
module Users
|
|
class NotificationSetting < ApplicationRecord
|
|
self.table_name_prefix = "users_"
|
|
validates :email_digest_periodic, inclusion: { in: [true, false] }
|
|
|
|
alias_attribute :subscribed_to_welcome_notifications?, :welcome_notifications
|
|
alias_attribute :subscribed_to_mod_roundrobin_notifications?, :mod_roundrobin_notifications
|
|
alias_attribute :subscribed_to_email_follower_notifications?, :email_follower_notifications
|
|
|
|
# NOTE: @ridhwana Need to account for
|
|
# subscribe_to_mailchimp_newsletter in app/models/user.rb
|
|
# code: return unless saved_changes.key?(:email) || saved_changes.key?(:email_newsletter)
|
|
end
|
|
end
|