Class: PostActionType
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- PostActionType
- Includes:
- AnonCacheInvalidator
- Defined in:
- app/models/post_action_type.rb
Class Attribute Summary collapse
-
.flag_settings ⇒ Object
readonly
Returns the value of attribute flag_settings.
Class Method Summary collapse
- .auto_action_flag_types ⇒ Object
- .custom_types ⇒ Object
- .flag_types ⇒ Object
- .flag_types_without_custom ⇒ Object
- .is_flag?(sym) ⇒ Boolean
-
.notify_flag_type_ids ⇒ Object
flags resulting in mod notifications.
- .notify_flag_types ⇒ Object
- .ordered ⇒ Object
- .public_type_ids ⇒ Object
- .public_types ⇒ Object
- .replace_flag_settings(settings) ⇒ Object
- .topic_flag_types ⇒ Object
- .types ⇒ Object
Instance Method Summary collapse
Class Attribute Details
.flag_settings ⇒ Object (readonly)
Returns the value of attribute flag_settings.
15 16 17 |
# File 'app/models/post_action_type.rb', line 15 def flag_settings @flag_settings end |
Class Method Details
.auto_action_flag_types ⇒ Object
41 42 43 |
# File 'app/models/post_action_type.rb', line 41 def auto_action_flag_types flag_settings.auto_action_types end |
.custom_types ⇒ Object
74 75 76 |
# File 'app/models/post_action_type.rb', line 74 def custom_types flag_settings.custom_types end |
.flag_types ⇒ Object
57 58 59 |
# File 'app/models/post_action_type.rb', line 57 def flag_types flag_settings.flag_types end |
.flag_types_without_custom ⇒ Object
53 54 55 |
# File 'app/models/post_action_type.rb', line 53 def flag_types_without_custom flag_settings.without_custom_types end |
.is_flag?(sym) ⇒ Boolean
78 79 80 |
# File 'app/models/post_action_type.rb', line 78 def is_flag?(sym) flag_types.valid?(sym) end |
.notify_flag_type_ids ⇒ Object
flags resulting in mod notifications
62 63 64 |
# File 'app/models/post_action_type.rb', line 62 def notify_flag_type_ids notify_flag_types.values end |
.notify_flag_types ⇒ Object
66 67 68 |
# File 'app/models/post_action_type.rb', line 66 def notify_flag_types flag_settings.notify_types end |
.ordered ⇒ Object
26 27 28 |
# File 'app/models/post_action_type.rb', line 26 def ordered order("position asc") end |
.public_type_ids ⇒ Object
49 50 51 |
# File 'app/models/post_action_type.rb', line 49 def public_type_ids @public_type_ids ||= public_types.values end |
.public_types ⇒ Object
45 46 47 |
# File 'app/models/post_action_type.rb', line 45 def public_types @public_types ||= types.except(*flag_types.keys << :notify_user) end |
.replace_flag_settings(settings) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/models/post_action_type.rb', line 17 def replace_flag_settings(settings) if settings @flag_settings = settings else initialize_flag_settings end @types = nil end |
.topic_flag_types ⇒ Object
70 71 72 |
# File 'app/models/post_action_type.rb', line 70 def topic_flag_types flag_settings.topic_flag_types end |
.types ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'app/models/post_action_type.rb', line 30 def types unless @types # NOTE: Previously bookmark was type 1 but that has been superseded # by the separate Bookmark model and functionality @types = Enum.new(like: 2) @types.merge!(flag_settings.flag_types) end @types end |
Instance Method Details
#expire_cache ⇒ Object
9 10 11 12 |
# File 'app/models/post_action_type.rb', line 9 def expire_cache ApplicationSerializer.expire_cache_fragment!(/\Apost_action_types_/) ApplicationSerializer.expire_cache_fragment!(/\Apost_action_flag_types_/) end |