Change user.name property to be equal to login_name, add separate accessor for realname

hinted-selects
Vitaliy Filippov 2014-08-27 16:50:36 +04:00
parent de967fa5c8
commit 93961db741
4 changed files with 14 additions and 13 deletions

View File

@ -264,7 +264,7 @@ sub set_login {
delete $self->{nick}; delete $self->{nick};
} }
sub set_name { sub set_realname {
my ($self, $name) = @_; my ($self, $name) = @_;
$self->set('realname', $name); $self->set('realname', $name);
delete $self->{identity}; delete $self->{identity};
@ -287,9 +287,10 @@ sub update_last_seen_date {
################################################################################ ################################################################################
# Accessors for user attributes # Accessors for user attributes
sub name { $_[0]->{realname}; } sub name { $_[0]->{login_name} }
sub login { $_[0]->{login_name}; } sub login { $_[0]->{login_name} }
sub email { $_[0]->login . Bugzilla->params->{'emailsuffix'}; } sub email { $_[0]->login . Bugzilla->params->{emailsuffix}; }
sub realname { $_[0]->{realname} }
sub disabledtext { $_[0]->{disabledtext}; } sub disabledtext { $_[0]->{disabledtext}; }
sub is_enabled { $_[0]->{is_enabled} } sub is_enabled { $_[0]->{is_enabled} }
sub showmybugslink { $_[0]->{mybugslink}; } sub showmybugslink { $_[0]->{mybugslink}; }

View File

@ -212,7 +212,7 @@ if ($action eq 'search') {
my $new_user = Bugzilla::User->create({ my $new_user = Bugzilla::User->create({
login_name => scalar $cgi->param('login'), login_name => scalar $cgi->param('login'),
cryptpassword => $password, cryptpassword => $password,
realname => scalar $cgi->param('name'), realname => scalar $cgi->param('realname'),
disabledtext => scalar $cgi->param('disabledtext'), disabledtext => scalar $cgi->param('disabledtext'),
disable_mail => scalar $cgi->param('disable_mail')}); disable_mail => scalar $cgi->param('disable_mail')});
@ -252,7 +252,7 @@ if ($action eq 'search') {
my $changes = {}; my $changes = {};
if ($editusers) { if ($editusers) {
$otherUser->set_login($cgi->param('login')); $otherUser->set_login($cgi->param('login'));
$otherUser->set_name($cgi->param('name')); $otherUser->set_realname($cgi->param('realname'));
$otherUser->set_password($cgi->param('password')) $otherUser->set_password($cgi->param('password'))
if $cgi->param('password'); if $cgi->param('password');
$otherUser->set_disabledtext($cgi->param('disabledtext')); $otherUser->set_disabledtext($cgi->param('disabledtext'));

View File

@ -39,14 +39,14 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th><label for="name">Real name:</label></th> <th><label for="realname">Real name:</label></th>
<td> <td>
[% IF editusers %] [% IF editusers %]
<input size="64" maxlength="255" name="name" <input size="64" maxlength="255" name="realname"
autocomplete="off" autocomplete="off"
id="name" value="[% otheruser.name FILTER html %]" /> id="realname" value="[% otheruser.realname FILTER html %]" />
[% ELSE %] [% ELSE %]
[% otheruser.name FILTER html %] [% otheruser.realname FILTER html %]
[% END %] [% END %]
</td> </td>
</tr> </tr>

View File

@ -14,7 +14,7 @@
# Portions created by the Initial Developer are Copyright (C) 2007 # Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved. # the Initial Developer. All Rights Reserved.
# #
# Contributor(s): # Contributor(s):
# Daniel Brooks <db48x@db48x.net> # Daniel Brooks <db48x@db48x.net>
# Max Kanat-Alexander <mkanat@bugzilla.org> # Max Kanat-Alexander <mkanat@bugzilla.org>
#%] #%]
@ -29,8 +29,8 @@
<a class="email" href="[% Param("user_mailto") %][% who.email FILTER html %]" <a class="email" href="[% Param("user_mailto") %][% who.email FILTER html %]"
title="[% who.identity FILTER html %]"> title="[% who.identity FILTER html %]">
[%- END -%] [%- END -%]
[% IF who.name %] [% IF who.realname %]
<span class="fn">[% who.name FILTER html %]</span> <span class="fn">[% who.realname FILTER html %]</span>
[% ELSE %] [% ELSE %]
[% who.login FILTER email FILTER html %] [% who.login FILTER email FILTER html %]
[% END %] [% END %]