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