[Bps-public-commit] RT-Extension-MergeUsers branch, master, updated. 1.05-7-ge900bc0

? sunnavy sunnavy at bestpractical.com
Fri Jul 17 17:24:26 EDT 2020


The branch, master has been updated
       via  e900bc02055990e64bea128634289777ec3fcf09 (commit)
       via  9b35a04599e54d6f951470ec183dca506d961bb3 (commit)
       via  f430be06e14df86d4bb76aac5a0ae2b24297b31a (commit)
       via  b4b9e65dcefc0250239f69fc861e23bf25bfac2d (commit)
       via  38afdb613082e7c97a4c39f13b56e379131edeef (commit)
       via  92ad4a72a729a90f10afef09191741bbc0f3a1d3 (commit)
      from  f3c0b8e7a6774e5b3408415422c4f2fb694a6ec8 (commit)

Summary of changes:
 Changes                                            |  3 ++
 META.yml                                           |  4 +-
 Makefile.PL                                        |  1 +
 README                                             |  6 +--
 bin/rt-clean-merged-users.in                       |  2 +-
 bin/rt-merge-users.in                              |  2 +-
 bin/rt-update-merged-users.in                      |  2 +-
 .../Admin/Users/Modify.html/RightColumnBottom      | 52 ++++++++++++++++++++++
 inc/Module/Install/RTx.pm                          | 36 ++++++++++-----
 lib/RT/Extension/MergeUsers.pm                     |  8 ++--
 lib/RT/Extension/MergeUsers/Test.pm.in             |  2 +-
 11 files changed, 95 insertions(+), 23 deletions(-)

- Log -----------------------------------------------------------------
commit 92ad4a72a729a90f10afef09191741bbc0f3a1d3
Author: craig kaiser <craig at bestpractical.com>
Date:   Fri Jul 17 10:43:21 2020 -0400

    Add Bootstrap styles for RT5 installs

diff --git a/html/Callbacks/RT-Extension-MergeUsers/Admin/Users/Modify.html/RightColumnBottom b/html/Callbacks/RT-Extension-MergeUsers/Admin/Users/Modify.html/RightColumnBottom
index 2b6e29f..68bf58f 100644
--- a/html/Callbacks/RT-Extension-MergeUsers/Admin/Users/Modify.html/RightColumnBottom
+++ b/html/Callbacks/RT-Extension-MergeUsers/Admin/Users/Modify.html/RightColumnBottom
@@ -47,6 +47,57 @@
 %# END BPS TAGGED BLOCK }}}
 <br />
 <&| /Widgets/TitleBox, title => loc('Merge user') &>
+% if ( RT::Handle::cmp_version($RT::VERSION, '5.0.0') >= 0 ) {
+  <div class="form-row">
+    <div class="col-12">
+      <p class="error"><% $result||'' %></p>
+    </div>
+  </div>
+
+% my ($EffectiveId) = $UserObj->Attributes->Named("EffectiveId");
+% my @MergedUsers = @{$UserObj->GetMergedUsers->Content};
+% if ($EffectiveId) {
+<div class="form-row">
+  <div class="col-auto label">
+    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->NameAndEmail %></a>
+  </div>
+  <div class="col-auto">
+    <input class="form-control btn btn-primary" type="submit" name="Unmerge" value="Unmerge" />
+  </div>
+</div>
+% } elsif (@MergedUsers) {
+  <div class="form-row">
+    <div class="label text-left">
+      The following users have been merged into this user:
+    </div>
+  </div>
+%   foreach my $user_id (@MergedUsers) {
+%       my $user = RT::User->new($session{'CurrentUser'});
+%       $user->LoadOriginal(Id => $user_id);
+<div class="form-row">
+  <div class="col-4 text-left">
+    <% $user->NameAndEmail %>
+  </div>
+  <div class="col-4 value">
+    <input class="form-control btn btn-primary" type="submit" name="Unmerge<%$user_id%>" value="Unmerge">
+  </div>
+</div>
+%   }
+% } else {
+<div class="form-row">
+  <div class="label col-auto text-left">
+    Merge this user into:
+  </div>
+  <div class="value col-auto">
+    <input class="form-control" name="MergeUser" data-autocomplete="Users" data-autocomplete-return="Name" value="" />
+  </div>
+</div>
+% }
+% }
+% else {
 <p class="error"><% $result||'' %></p>
 % my ($EffectiveId) = $UserObj->Attributes->Named("EffectiveId");
 % my @MergedUsers = @{$UserObj->GetMergedUsers->Content};
@@ -65,6 +116,7 @@ The following users have been merged into this user:<br>
 % } else {
 Merge this user into: <input name="MergeUser" data-autocomplete="Users" data-autocomplete-return="Name" value="" />
 % }
+% }
 </&>
 <%init>
 return unless $UserObj->id;

commit 38afdb613082e7c97a4c39f13b56e379131edeef
Author: craig kaiser <craig at bestpractical.com>
Date:   Thu Jul 9 16:46:06 2020 -0400

    Update bin/ scripts from rt4 to rt5 as default lib location

diff --git a/bin/rt-clean-merged-users.in b/bin/rt-clean-merged-users.in
index 40367da..dd427a2 100755
--- a/bin/rt-clean-merged-users.in
+++ b/bin/rt-clean-merged-users.in
@@ -5,7 +5,7 @@ use strict;
 use warnings;
 
 ### after: use lib qw(@RT_LIB_PATH@);
-use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
+use lib qw(/opt/rt5/local/lib /opt/rt5/lib);
 use RT;
 RT::LoadConfig();
 RT::Init();
diff --git a/bin/rt-merge-users.in b/bin/rt-merge-users.in
index ffe82b4..131f535 100755
--- a/bin/rt-merge-users.in
+++ b/bin/rt-merge-users.in
@@ -10,7 +10,7 @@ my ($from, $into) = @ARGV;
 die "\n$usage\n" unless $from && $into;
 
 ### after: use lib qw(@RT_LIB_PATH@);
-use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
+use lib qw(/opt/rt5/local/lib /opt/rt5/lib);
 use RT;
 RT::LoadConfig();
 RT::Init();
diff --git a/bin/rt-update-merged-users.in b/bin/rt-update-merged-users.in
index 34b53bc..75e6eb6 100755
--- a/bin/rt-update-merged-users.in
+++ b/bin/rt-update-merged-users.in
@@ -5,7 +5,7 @@ use strict;
 use warnings;
 
 ### after: use lib qw(@RT_LIB_PATH@);
-use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
+use lib qw(/opt/rt5/local/lib /opt/rt5/lib);
 use RT;
 RT::LoadConfig();
 RT::Init();
diff --git a/lib/RT/Extension/MergeUsers/Test.pm.in b/lib/RT/Extension/MergeUsers/Test.pm.in
index 1f9bb4b..1cfede6 100644
--- a/lib/RT/Extension/MergeUsers/Test.pm.in
+++ b/lib/RT/Extension/MergeUsers/Test.pm.in
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 
 ### after: use lib qw(@RT_LIB_PATH@);
-use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
+use lib qw(/opt/rt5/local/lib /opt/rt5/lib);
 
 package RT::Extension::MergeUsers::Test;
 

commit b4b9e65dcefc0250239f69fc861e23bf25bfac2d
Author: craig kaiser <craig at bestpractical.com>
Date:   Thu Jul 9 16:47:26 2020 -0400

    Update POD to reference RT5

diff --git a/README b/README
index c75f3d7..31625be 100644
--- a/README
+++ b/README
@@ -3,7 +3,7 @@ NAME
     user
 
 RT VERSION
-    Works with RT 4.0, 4.2 and 4.4.
+    Works with RT 4.0, 4.2, 4.4, 5.0.
 
 DESCRIPTION
     This RT extension adds a "Merge Users" box to the User Administration
@@ -26,7 +26,7 @@ INSTALLATION
     make install
         May need root permissions
 
-    Edit your /opt/rt4/etc/RT_SiteConfig.pm
+    Edit your /opt/rt5/etc/RT_SiteConfig.pm
         If you are using RT 4.2 or greater, add this line:
 
             Plugin('RT::Extension::MergeUsers');
@@ -38,7 +38,7 @@ INSTALLATION
         or add RT::Extension::MergeUsers to your existing @Plugins line.
 
     Clear your mason cache
-            rm -rf /opt/rt4/var/mason_data/obj
+            rm -rf /opt/rt5/var/mason_data/obj
 
     Restart your webserver
 
diff --git a/lib/RT/Extension/MergeUsers.pm b/lib/RT/Extension/MergeUsers.pm
index 55928b9..e15eaef 100644
--- a/lib/RT/Extension/MergeUsers.pm
+++ b/lib/RT/Extension/MergeUsers.pm
@@ -63,7 +63,7 @@ RT::Extension::MergeUsers - Merges two users into the same effective user
  
 =head1 RT VERSION
 
-Works with RT 4.0, 4.2 and 4.4.
+Works with RT 4.0, 4.2, 4.4, 5.0.
 
 =head1 DESCRIPTION
 
@@ -92,7 +92,7 @@ Be sure to also read L</UPGRADING> if you are upgrading.
 
 May need root permissions
 
-=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
+=item Edit your F</opt/rt5/etc/RT_SiteConfig.pm>
 
 If you are using RT 4.2 or greater, add this line:
 
@@ -106,7 +106,7 @@ or add C<RT::Extension::MergeUsers> to your existing C<@Plugins> line.
 
 =item Clear your mason cache
 
-    rm -rf /opt/rt4/var/mason_data/obj
+    rm -rf /opt/rt5/var/mason_data/obj
 
 =item Restart your webserver
 

commit f430be06e14df86d4bb76aac5a0ae2b24297b31a
Author: craig kaiser <craig at bestpractical.com>
Date:   Thu Jul 9 16:47:35 2020 -0400

    Update Module::Install

diff --git a/META.yml b/META.yml
index 5b7ec55..0c6bc97 100644
--- a/META.yml
+++ b/META.yml
@@ -29,5 +29,5 @@ resources:
   license: http://opensource.org/licenses/gpl-license.php
   repository: https://github.com/bestpractical/rt-extension-mergeusers
 version: '1.05'
-x_module_install_rtx_version: '0.40'
+x_module_install_rtx_version: '0.42'
 x_requires_rt: 4.0.0
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 7cad529..2dd9489 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -6,9 +6,10 @@ use strict;
 use warnings;
 no warnings 'once';
 
+use Term::ANSIColor qw(:constants);
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.40';
+our $VERSION = '0.42';
 
 use FindBin;
 use File::Glob     ();
@@ -53,7 +54,7 @@ sub RTx {
         my @look = @INC;
         unshift @look, grep {defined and -d $_} @try;
         push @look, grep {defined and -d $_}
-            map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
+            map { ( "$_/rt5/lib", "$_/lib/rt5", "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
         last if eval {local @INC = @look; require RT; $RT::LocalLibPath};
 
         warn
@@ -76,6 +77,22 @@ sub RTx {
         $self->requires_rt('4.0.0');
     }
 
+    my $package = $name;
+    $package =~ s/-/::/g;
+    if ( $RT::CORED_PLUGINS{$package} ) {
+        my ($base_version) = $RT::VERSION =~ /(\d+\.\d+\.\d+)/;
+        die RED, <<"EOT";
+
+**** Error: Your installed version of RT ($RT::VERSION) already
+            contains this extension in core, so you don't need to
+            install it.
+
+            Check https://docs.bestpractical.com/rt/$base_version/RT_Config.html
+            to configure it.
+
+EOT
+    }
+
     # Installation locations
     my %path;
     my $plugin_path;
@@ -223,7 +240,7 @@ sub requires_rt {
     my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[-1] eq $version) {
-        die <<"EOT";
+        die RED, <<"EOT";
 
 **** Error: This extension requires RT $version. Your installed version
             of RT ($RT::VERSION) is too old.
@@ -249,12 +266,12 @@ sub requires_rt_plugin {
         unshift @INC, $path;
     } else {
         my $name = $self->name;
-        warn <<"EOT";
+        my $msg = <<"EOT";
 
 **** Warning: $name requires that the $plugin plugin be installed and
               enabled; it does not appear to be installed.
-
 EOT
+        warn RED, $msg, RESET, "\n";
     }
     $self->requires(@_);
 }
@@ -264,9 +281,8 @@ sub rt_too_new {
     my $name = $self->name;
     $msg ||= <<EOT;
 
-**** Error: Your installed version of RT (%s) is too new; this extension
-            only works with versions older than %s.
-
+**** Warning: Your installed version of RT (%s) is too new; this extension
+              has not been tested on your version of RT and may not work as expected.
 EOT
     $self->add_metadata("x_rt_too_new", $version) if $self->is_admin;
 
@@ -274,7 +290,7 @@ EOT
     my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
 
     if ($sorted[0] eq $version) {
-        die sprintf($msg,$RT::VERSION,$version);
+        warn RED, sprintf($msg,$RT::VERSION), RESET, "\n";
     }
 }
 
@@ -297,4 +313,4 @@ sub _load_rt_handle {
 
 __END__
 
-#line 468
+#line 484

commit 9b35a04599e54d6f951470ec183dca506d961bb3
Author: craig kaiser <craig at bestpractical.com>
Date:   Thu Jul 16 08:09:30 2020 -0400

    Include '.' in @INC for perl 5.26+

diff --git a/Makefile.PL b/Makefile.PL
index 7e9deb4..c159943 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,3 +1,4 @@
+use lib '.';
 use inc::Module::Install;
 
 RTx 'RT-Extension-MergeUsers';

commit e900bc02055990e64bea128634289777ec3fcf09
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jul 18 05:07:32 2020 +0800

    Prep 1.06

diff --git a/Changes b/Changes
index 2135999..b117e9b 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for RT-Extension-MergeUsers
 
+1.06 2020-07-17
+ - Add RT 5 support
+
 1.05 2020-02-05
  - Fix the logic of "skipping duplicated records" in users collections
 
diff --git a/META.yml b/META.yml
index 0c6bc97..919c158 100644
--- a/META.yml
+++ b/META.yml
@@ -28,6 +28,6 @@ requires:
 resources:
   license: http://opensource.org/licenses/gpl-license.php
   repository: https://github.com/bestpractical/rt-extension-mergeusers
-version: '1.05'
+version: '1.06'
 x_module_install_rtx_version: '0.42'
 x_requires_rt: 4.0.0
diff --git a/lib/RT/Extension/MergeUsers.pm b/lib/RT/Extension/MergeUsers.pm
index e15eaef..2bd3abd 100644
--- a/lib/RT/Extension/MergeUsers.pm
+++ b/lib/RT/Extension/MergeUsers.pm
@@ -55,7 +55,7 @@ use RT::Shredder;
 
 package RT::Extension::MergeUsers;
 
-our $VERSION = '1.05';
+our $VERSION = '1.06';
 
 =head1 NAME
 

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list