diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-08-27 11:46:52 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-09-16 14:03:21 +0100 |
commit | 5eccab4732791d2aa2d4de93b071f5f4f3add7d7 (patch) | |
tree | 5be704f20a3a7aeb6eb4841d623c9ad85fbc9756 /lib/message_prominence.rb | |
parent | 48423ee208d3e81c81b156a8fe42f1be0055cb49 (diff) |
Create MessageProminence module.
At least some of the logic for incoming and outgoing message prominence
is going to be identical, so move it to a module they can both include
and use.
Diffstat (limited to 'lib/message_prominence.rb')
-rw-r--r-- | lib/message_prominence.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/message_prominence.rb b/lib/message_prominence.rb new file mode 100644 index 000000000..7bb8f3cf8 --- /dev/null +++ b/lib/message_prominence.rb @@ -0,0 +1,18 @@ +module MessageProminence + + def has_prominence(prominence_states) + send :include, InstanceMethods + cattr_accessor :prominence_states + self.prominence_states = prominence_states + validates_inclusion_of :prominence, :in => self.prominence_states + end + + module InstanceMethods + + def user_can_view?(user) + Ability.can_view_with_prominence?(self.prominence, self.info_request, user) + end + + end +end + |