Module: DiscourseTask::Plugin::GuardianMixin
- Defined in:
- lib/discourse_task/plugin.rb
Instance Method Summary collapse
-
#can_complete_task?(topic) ⇒ Boolean
We need to be able to determine if a user can complete a task.
Instance Method Details
#can_complete_task?(topic) ⇒ Boolean
We need to be able to determine if a user can complete a task
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/discourse_task/plugin.rb', line 46 def can_complete_task?(topic) return false if @user.blank? return false if topic.blank? return false unless topic.archetype == DiscourseTask::Plugin.archetype return true if @user.moderator? return true if @user.admin? # The OP can complete the topic return @user == topic.user end |