redmine_custom_workflows icon indicating copy to clipboard operation
redmine_custom_workflows copied to clipboard

Add watchers

Open VictorSF1 opened this issue 5 years ago • 5 comments

Hi, How to handle the event when adding an watchers? For example, when adding new watchers, send him custom emails.

VictorSF1 avatar Jan 15 '20 06:01 VictorSF1

@VictorSF1 What is reason to give info to user, that were add as watcher? If you add user as watcher and write comment, he receives notification...

DolezalDavid avatar Nov 05 '20 10:11 DolezalDavid

If I write a comment, both the performer and other watchers will receive it. And I need to send an custom message to the currently added watchers. Are there any plans to add a trigger to watchers?

VictorSF1 avatar Jun 06 '21 12:06 VictorSF1

@VictorSF1 Have you solved it ? I have the same issue , I need to send notications(not email) to watchers using a custom script

oldunclez avatar May 13 '24 02:05 oldunclez

I managed to auto add specific watcher on specific status & tracker with this code:

# Check if the status_id of the issue has changed
if @issue.status_id_changed?

  # Check if the tracker_id of the issue is YOUR ID
  if @issue.tracker_id == YOUR ID

    # Check if the status_id is YOUR ID 
    if @issue.status_id == YOUR ID
      # Add watcher
      self.add_watcher(User.find_by_id(YOUR ID))
    end
  end
end

nekrasovdmitriy avatar May 17 '24 07:05 nekrasovdmitriy

I managed to auto add specific watcher on specific status & tracker with this code:

# Check if the status_id of the issue has changed
if @issue.status_id_changed?

  # Check if the tracker_id of the issue is YOUR ID
  if @issue.tracker_id == YOUR ID

    # Check if the status_id is YOUR ID 
    if @issue.status_id == YOUR ID
      # Add watcher
      self.add_watcher(User.find_by_id(YOUR ID))
    end
  end
end

Thank you for your reply. But maybe you misunderstand this issue. It is to do something when adding watcher, instead of , adding watcher when status changed. I am going to do it following https://www.redmine.org/issues/1757

oldunclez avatar May 20 '24 01:05 oldunclez