action: function()

in js/restricting-issue-visibility/add-mentioned-users-to-visible-to-list.js [13:39]


  action: function(ctx) {
    var issue = ctx.issue;
    var text = '';
    issue.comments.added.forEach(function (comment) {
      text += comment.text + '\n';
    });
    var message = '';
    var matches = text.match(loginRegex);
    if (matches) {
      matches.forEach(function(m) {
        var login = m.slice(1);
        if (login) {
          var user = entities.User.findByLogin(login);
          if (user) {
            issue.permittedUsers.add(user);
            message += 'User "' + user.fullName +
              '" is added to issue readers. ';
          } else {
            message += 'User with login "' + login + '" not found. ';
          }
        }
      });
    }
    if (message) {
      workflow.message(message);
    }
  },