I don't need to add user to watchers

        if (!issue.isVisibleTo(newuser)){
          console.log("The following user will have access: " + newuser.login);
          issue.permittedUsers.add(newuser);
        }

When I add a user in this way, he automatically becomes the watcher of the Issue. Can this be turned off somehow?

4 comments
Comment actions Permalink

Hello,

My name is Lena; thank you for contacting us. 

This operation doesn't intend to add the user to the watchers. However, this behavior could be caused by the specific user Notification settings. Please open the user profile, navigate to the Notifications page and check if in the "Star automatically when" section, the "I am made responsible for an issue" checkbox is not selected. If it is selected, please unselect it and try again. 

 

 

 

0
Comment actions Permalink

Hello,

It is very uncomfortable. I have an "Assignee" field. Also a custom field where users of other projects are indicated from which some information is needed. And they don't need to be added as watchers. And they don't need to turn it off in the settings. It turns out badly that the custom field does not have the ability to disable this behavior in case I have two fields where users are specified.

0
Comment actions Permalink

I also have another problem. I wrote a script in which I send a notification to users. These users are selected in the dialog (ctx.issue.fields.required). And when I send an email with the sendMail function (newuser.sendMail(lettersubject, letterbody);), the subject of the email is not set to the one I pass. The email comes with the subject [YouTrack, Created] Issue (...)

0
Comment actions Permalink

Hello,

Unfortunately, we don't have immediate plans to change this behavior. However, I passed your feedback to our R&D team. Thank you for that. 

 

As for the second question, could you please send me a sample workflow illustrating the issue? I tested this method, and it works as described: 

exports.rule = entities.Issue.onChange({
  title: 'Test-email',
  guard: (ctx) => {
    return true;
  },
  action: (ctx) => {
    const issue = ctx.issue;
    issue.reporter.sendMail("topic", "body");
  },
});

 

Please also ensure you didn't mix it up with the notifications.sendEmail() method. 

 

0

Please sign in to leave a comment.