aboutsummaryrefslogtreecommitdiffstats
path: root/lib/message_prominence.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/message_prominence.rb')
-rw-r--r--lib/message_prominence.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/message_prominence.rb b/lib/message_prominence.rb
new file mode 100644
index 000000000..8f54fcc95
--- /dev/null
+++ b/lib/message_prominence.rb
@@ -0,0 +1,26 @@
+module MessageProminence
+
+ def has_prominence
+ send :include, InstanceMethods
+ cattr_accessor :prominence_states
+ self.prominence_states = ['normal', 'hidden','requester_only']
+ 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
+
+ def indexed_by_search?
+ self.prominence == 'normal'
+ end
+
+ def all_can_view?
+ self.prominence == 'normal'
+ end
+
+ end
+end
+