I cannot seem to find details on the "mention users" feature in 5.0

  • 5
  • 23

Hi!

I was looking for a workflow to automatically send a notification to a user that is mentioned in a comment (as in "@username"), and was very happy to see this paragraph on the "What's new in YouTrack 5.0" website:

"Be more convincing and less ambiguous with the new wiki markup for visual descriptions and comments: use HTML tags, mention users, and much more."

However, I can't seem to find anything more about this feature. Can anyone help me find some more information about it? Thanks.
Hi Salvar,

'@username' feature only makes the link to user profile if 'username' exists in YouTrack.

It doesn't send notification to the mentioned user because usually such commented issues are watched by the mentioned user itself so it would be duplicated notification.

Anyway if you need such workflow please try this one:
rule Recongize user from comment 
 
when comments.added.isNotEmpty { 
  var extractedUsername = comments.added.first.text.substringBetween("@", " "); 
  if (extractedUsername != null && extractedUsername.isNotBlank) { 
    var extractedUser = project.getUser(extractedUsername); 
     
    if (extractedUser != null) { 
      extractedUser.notify("[Youtrack, Comment notice]", "You (" + (extractedUser.fullName) + ") were mentioned in comment of issue " + "<a href=\"" + getUrl() + "\">" + getId() + "</a>:" + "<br><div style=\"color: #666666;margin-top: .7em;font-size: 90%;font-style: italic\">" + ">" + comments.added.first.text + "</div>", true); 
    } 
     
  } 
}

mentionedUser.zip (3.3KB)

I, too, got confused by this, thinking that it would send the notification. I was looking forward to retiring my workflow that handles this, since a built-in feature will certainly be more robust than my workflow (which, for example, doesn't handle mentions of more than one user). However, without the notification, it's useless to me.

In my opinion, this feature is of very limited use without notifications. After all, if someone already has a role on the task (e.g., as a watcher or assignee), then, as you said, they're already getting notifications and presumably already reading comments or changes. Thus, there's no point in specifically naming these users in a comment. On the other hand, if they're ignoring comments even though they're receiving notifications, then what's the point of mentions if a mention is nothing more than a highlighting in a comment that's not going to be read?

Hi Dmitry, and thanks for the incredibly quick response!

I see your point on the possibility of duplicating notifications, but I believe our use case could have a good number of situations where the mentioned user isn't watching the issue. Maybe the workflow could be modified to only send a mention notification if the mentioned user is not watching the issue?

Anyway, the workflow you posted should work nicely for us. Thanks!

You can avoid sending notifications to already watching user by the additional check:
rule Recongize user from comment 
 
when comments.added.isNotEmpty { 
  var extractedUsername = comments.added.first.text.substringBetween("@", " "); 
  if (extractedUsername != null && extractedUsername.isNotBlank) { 
    var extractedUser = project.getUser(extractedUsername); 
     
    if (extractedUser != null && !extractedUser.getIssues(Everything, "tag: Star").contains(issue)) { 
      extractedUser.notify("[Youtrack, Comment notice]", "You (" + (extractedUser.fullName) + ") were mentioned in comment of issue " + "<a href=\"" + getUrl() + "\">" + getId() + "</a>:" + "<br><div style=\"color: #666666;margin-top: .7em;font-size: 90%;font-style: italic\">" + ">" + comments.added.first.text + "</div>", true); 
    } 
  } 
}


But please keep it mind that it can be the performance issue.
mentionedUser.zip (3.6KB)