Feature #11718 ยป watcher.patch
| issue.rb (working copy) | ||
|---|---|---|
|
"(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
|
||
|
when 'own'
|
||
|
user_ids = [user.id] + user.groups.map(&:id)
|
||
|
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
|
||
|
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}) OR (SELECT count(*) FROM #{Watcher.table_name}
|
||
|
WHERE watchable_id = #{table_name}.id AND user_id = #{user.id}) > 0)"
|
||
|
else
|
||
|
'1=0'
|
||
|
end
|
||
| ... | ... | |
|
when 'default'
|
||
|
!self.is_private? || self.author == user || user.is_or_belongs_to?(assigned_to)
|
||
|
when 'own'
|
||
|
self.author == user || user.is_or_belongs_to?(assigned_to)
|
||
|
self.author == user || user.is_or_belongs_to?(assigned_to) || self.watched_by?(user)
|
||
|
else
|
||
|
false
|
||
|
end
|
||