OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/services/remove_watcher.rb

16 lines
332 B

class Services::RemoveWatcher
def initialize(work_package, user)
@work_package = work_package
@user = user
end
def run(success = -> {}, failure = -> {})
if @work_package.watcher_users.include?(@user)
@work_package.watcher_users.delete(@user)
success.call
else
failure.call
end
end
end