Permalink
Browse files

Show the name and the email of the user (unless they're the same)

mimics some of the behavior of 3.8's new user display even on 3.6

Based on proposed patch from Jason A Smith
  • Loading branch information...
1 parent b1091d2 commit a1eb2b4e76f4c95fd4341abad22c168605579590 @jibsheet jibsheet committed Oct 3, 2009
View
4 html/Callbacks/RT-Extension-MergeUsers/Admin/Users/Modify.html/RightColumnBottom
@@ -54,13 +54,13 @@
This user has been merged with <a href="Modify.html?id=<% $EffectiveId->Content %>">
% my $real = RT::User->new($session{'CurrentUser'});
% $real->Load($EffectiveId->Content);
-<% $real->EmailAddress %></a>; <input type="submit" name="Unmerge" value="Unmerge" />
+<% $real->NameAndEmail %></a>; <input type="submit" name="Unmerge" value="Unmerge" />
% } elsif ($MergedUsers) {
The following users have been merged into this user:<br>
% foreach my $user_id (@{$MergedUsers->Content}) {
% my $user = RT::User->new($session{'CurrentUser'});
% $user->LoadOriginal(Id => $user_id);
-<% $user->EmailAddress %><input type="submit" name="Unmerge<%$user_id%>" value="Unmerge"><br>
+<% $user->NameAndEmail %><input type="submit" name="Unmerge<%$user_id%>" value="Unmerge"><br>
% }
% } else {
Merge this user into: <input name="MergeUser" value="" />
View
15 lib/RT/Extension/MergeUsers.pm
@@ -223,6 +223,7 @@ sub UnMerge {
$merge->Comments,
$self->EmailAddress ." (". $self->id .") unmerged from this user",
);
+
my $merged_users = $merge->GetMergedUsers;
my @remaining_users = grep { $_ != $self->Id } @{$merged_users->Content};
if (@remaining_users) {
@@ -231,7 +232,7 @@ sub UnMerge {
$merged_users->Delete;
}
- return ($merge->id, "Unmerged from @{[$merge->EmailAddress]}");
+ return ($merge->id, "Unmerged @{[$self->NameAndEmail]} from @{[$merge->NameAndEmail]}");
}
sub SetEmailAddress {
@@ -253,6 +254,18 @@ sub SetEmailAddress {
return $self->_Set( Field => 'EmailAddress', Value => $value );
}
+sub NameAndEmail {
+ my $self = shift;
+ my $name = $self->Name;
+ my $email = $self->EmailAddress;
+
+ if ($name eq $email) {
+ return $email;
+ } else {
+ return "$name <$email>";
+ }
+}
+
package RT::Users;
use RT::Users;

0 comments on commit a1eb2b4

Please sign in to comment.