Closed Bug 1766121 Opened 2 years ago Closed 2 years ago

Add a note about nickname syntax in userprefs.cgi Account page

Categories

(bugzilla.mozilla.org :: General, enhancement)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

According to the following code, nickname data is extracted from the real name field and it's used for some field (e.g. Reporter).
It would be nice to mention the syntax and how it's used, in userprefs.cgi page Account pane, below "Your real name" field, so that it's discoverable.

https://github.com/mozilla-bteam/bmo/blob/a20fbcafd368cdc6c07308ce603b931a2fc97623/Bugzilla/User.pm#L486-L490


sub set_name {
  my ($self, $name) = @_;
  $self->set('realname', $name);
  delete $self->{identity};
  $self->set('nickname', _generate_nickname($name, $self->login, $self->id));

https://github.com/mozilla-bteam/bmo/blob/a20fbcafd368cdc6c07308ce603b931a2fc97623/Bugzilla/User.pm#L470-L484

sub _generate_nickname {
  my ($name, $login, $id) = @_;
  my ($nick) = extract_nicks($name);

https://github.com/mozilla-bteam/bmo/blob/a20fbcafd368cdc6c07308ce603b931a2fc97623/Bugzilla/Util.pm#L954-L974

sub extract_nicks {
  my ($name) = @_;
  return () unless defined $name;
  my @nicks = (
    $name =~ /
            # This negative lookbehind lets us
            # match colons that are not followed by numbers.
            (?<!\d)
            :
            # try tp capture a "word", plus some symbols
            # this covers most everything people use for IRC nicks
            # in BMO.
            ([\p{IsAlnum}|._-]+)
            # require a word terminator, which
            # can be the end of the string or some punctuation.
            \b
        /mgx
  );

  return grep { defined $_ } @nicks;
}

https://github.com/mozilla-bteam/bmo/blob/a20fbcafd368cdc6c07308ce603b931a2fc97623/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl#L715

  sub.push("Reporter: " _ bug.reporter.nick);
Attached file GitHub Pull Request
Assignee: nobody → arai.unmht
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: