0002-modif-watchers.patch

Jonathan Griffon, 2021-11-17 16:53

Download (1.14 KB)

View differences:

app/controllers/watchers_controller.rb
135 135
  def users_for_new_watcher
136 136
    scope = nil
137 137
    if params[:q].blank? && @project.present?
138
      scope = @project.principals.assignable_watchers
138
      scope = @project.users
139 139
    else
140
      scope = Principal.assignable_watchers.limit(100)
140
      scope = User.all.limit(100)
141 141
    end
142 142
    users = scope.sorted.like(params[:q]).to_a
143 143
    if @watchables && @watchables.size == 1
144
      watchable_object = @watchables.first
145
      users -= watchable_object.watcher_users
146

  
147
      if watchable_object.respond_to?(:visible?)
148
        users.reject! {|user| user.is_a?(User) && !watchable_object.visible?(user)}
149
      end
144
      users -= @watchables.first.watcher_users
150 145
    end
151 146
    users
152 147
  end