Merge pull request #8564 from opf/problem-with-watchers-in-watchers-tab

[33936] Problem with watchers
pull/8570/head
ulferts 4 years ago committed by GitHub
commit 8a3f9cadb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lib/api/v3/work_packages/watchers_api.rb
  2. 13
      spec/requests/api/v3/watcher_resource_spec.rb

@ -57,7 +57,7 @@ module API
resources :watchers do resources :watchers do
helpers do helpers do
def watchers_collection def watchers_collection
watchers = @work_package.watcher_users watchers = @work_package.watcher_users.active_or_registered
self_link = api_v3_paths.work_package_watchers(@work_package.id) self_link = api_v3_paths.work_package_watchers(@work_package.id)
Users::UserCollectionRepresenter.new(watchers, Users::UserCollectionRepresenter.new(watchers,
self_link, self_link,

@ -58,6 +58,19 @@ describe 'API v3 Watcher resource', type: :request, content_type: :json do
FactoryBot.create(:watcher, watchable: work_package, user: watching_user) FactoryBot.create(:watcher, watchable: work_package, user: watching_user)
end end
let!(:watching_blocked_user) do
FactoryBot.create :user,
login: 'lockedUser',
mail: 'lockedUser@gmail.com',
member_in_project: project,
member_through_role: view_work_packages_role
end
let!(:existing_blocked_watcher) do
FactoryBot.create(:watcher, watchable: work_package, user: watching_blocked_user).tap do
watching_blocked_user.lock!
end
end
subject(:response) { last_response } subject(:response) { last_response }
before do before do

Loading…
Cancel
Save