[Rt-commit] rt branch, 4.4/disabled-articles, repushed
? sunnavy
sunnavy at bestpractical.com
Mon Jan 12 10:23:48 EST 2015
The branch 4.4/disabled-articles was deleted and repushed:
was 4644c1f49207ad4d3f71dbbbf7f1472139cc03df
now b89f38bdea056114555e253007045dfec484ae76
-: ------- > 1: d8b3882 fix description since "ModifyArticle" right can't _delete_ articles
1: 4644c1f ! 2: 527aaf0 don't delete articles, just disable them.
@@ -2,15 +2,7 @@
don't delete articles, just disable them.
- So the right "DeleteArticle" is renamed to "DisableArticle".
- Note that in previous description of "ModifyArticle" right, it's:
-
- Modify or delete articles in this class
-
- it's not true because we only checked "DeleteArticle" in RT::Article->Delete,
- so I fixed the description
-
- Fixes: #19323
+ Fixes: I#19323
diff --git a/etc/schema.Oracle b/etc/schema.Oracle
--- a/etc/schema.Oracle
@@ -60,33 +52,37 @@
Created datetime default NULL,
LastUpdatedBy int(11) NOT NULL default '0',
-diff --git a/etc/upgrade/4.3.4/schema.Oracle b/etc/upgrade/4.3.4/schema.Oracle
+diff --git a/etc/upgrade/4.3.7/schema.Oracle b/etc/upgrade/4.3.7/schema.Oracle
new file mode 100644
--- /dev/null
-+++ b/etc/upgrade/4.3.4/schema.Oracle
-@@
-+ALTER TABLE Articles ADD COLUMN Disabled NUMBER(11,0) DEFAULT 0 NOT NULL;
-
-diff --git a/etc/upgrade/4.3.4/schema.Pg b/etc/upgrade/4.3.4/schema.Pg
++++ b/etc/upgrade/4.3.7/schema.Oracle
+@@
++ALTER TABLE Articles ADD Disabled NUMBER(11,0) DEFAULT 0 NOT NULL;
++UPDATE ACL SET RightName='DisableArticle' WHERE RightName='DeleteArticle';
+
+diff --git a/etc/upgrade/4.3.7/schema.Pg b/etc/upgrade/4.3.7/schema.Pg
new file mode 100644
--- /dev/null
-+++ b/etc/upgrade/4.3.4/schema.Pg
++++ b/etc/upgrade/4.3.7/schema.Pg
@@
+ALTER TABLE Articles ADD COLUMN Disabled smallint NOT NULL DEFAULT 0;
-
-diff --git a/etc/upgrade/4.3.4/schema.SQLite b/etc/upgrade/4.3.4/schema.SQLite
++UPDATE ACL SET RightName='DisableArticle' WHERE RightName='DeleteArticle';
+
+diff --git a/etc/upgrade/4.3.7/schema.SQLite b/etc/upgrade/4.3.7/schema.SQLite
new file mode 100644
--- /dev/null
-+++ b/etc/upgrade/4.3.4/schema.SQLite
++++ b/etc/upgrade/4.3.7/schema.SQLite
@@
+ALTER TABLE Articles ADD COLUMN Disabled smallint NOT NULL DEFAULT 0;
-
-diff --git a/etc/upgrade/4.3.4/schema.mysql b/etc/upgrade/4.3.4/schema.mysql
++UPDATE ACL SET RightName='DisableArticle' WHERE RightName='DeleteArticle';
+
+diff --git a/etc/upgrade/4.3.7/schema.mysql b/etc/upgrade/4.3.7/schema.mysql
new file mode 100644
--- /dev/null
-+++ b/etc/upgrade/4.3.4/schema.mysql
++++ b/etc/upgrade/4.3.7/schema.mysql
@@
+ALTER TABLE Articles ADD COLUMN Disabled int(2) NOT NULL DEFAULT 0;
++UPDATE ACL SET RightName='DisableArticle' WHERE RightName='DeleteArticle';
diff --git a/lib/RT/Article.pm b/lib/RT/Article.pm
--- a/lib/RT/Article.pm
@@ -115,7 +111,7 @@
-Delete all its custom field values
-Delete all its relationships
-Delete this article.
-+ This doesn't really delete but disable the article.
++This does not remove from the database; it merely sets the Disabled bit.
=cut
@@ -209,7 +205,7 @@
+=head2 Disabled
+
-+Returns the current value of Disabled.
++Returns the current value of Disabled.
+(In the database, Disabled is stored as int(2).)
+
+
@@ -217,7 +213,7 @@
+=head2 SetDisabled VALUE
+
+
-+Set Disabled to VALUE.
++Set Disabled to VALUE.
+Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
+(In the database, Disabled will be stored as a int(2).)
+
@@ -251,14 +247,6 @@
--- a/lib/RT/Class.pm
+++ b/lib/RT/Class.pm
@@
- __PACKAGE__->AddRight( General => ShowArticle => 'See articles in this class'); # loc
- __PACKAGE__->AddRight( Staff => ShowArticleHistory => 'See changes to articles in this class'); # loc
- __PACKAGE__->AddRight( General => SeeCustomField => 'View custom field values' ); # loc
--__PACKAGE__->AddRight( Staff => ModifyArticle => 'Modify or delete articles in this class'); # loc
-+__PACKAGE__->AddRight( Staff => ModifyArticle => 'Modify articles in this class'); # loc
- __PACKAGE__->AddRight( Staff => ModifyArticleTopics => 'Modify topics for articles in this class'); # loc
- __PACKAGE__->AddRight( Staff => ModifyCustomField => 'Modify custom field values' ); # loc
- __PACKAGE__->AddRight( Admin => AdminClass => 'Modify metadata and custom fields for this class'); # loc
__PACKAGE__->AddRight( Admin => AdminTopics => 'Modify topic hierarchy associated with this class'); # loc
__PACKAGE__->AddRight( Admin => ShowACL => 'Display Access Control List'); # loc
__PACKAGE__->AddRight( Admin => ModifyACL => 'Create, modify and delete Access Control List entries'); # loc
@@ -426,7 +414,7 @@
+<td>
+ <input type="hidden" class="hidden" name="SetEnabled" value="1" />
+ <input type="checkbox" class="checkbox" id="Enabled" name="Enabled" value="1" <% ( $ArticleObj->id && $ArticleObj->Disabled || $ARGS{'Disabled'} ) ? '' : 'checked="checked"' |n %> />
-+ <label for="Enabled"><&|/l&>Enabled (Unchecking this box disables this custom field)</&></label>
++ <label for="Enabled"><&|/l&>Enabled (Unchecking this box disables this article)</&></label>
+</td>
+</tr>
+% }
@@ -434,6 +422,148 @@
</%INIT>
<%ARGS>
+diff --git a/share/html/Elements/BulkLinks b/share/html/Elements/BulkLinks
+--- a/share/html/Elements/BulkLinks
++++ b/share/html/Elements/BulkLinks
+@@
+ <td class="value">
+ % if ( $hash{DependsOn} ) {
+ % for my $link ( values %{$hash{DependsOn}} ) {
+- <input type="checkbox" class="checkbox" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
+- <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& /Elements/ShowLink, URI => $link->TargetURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Target' &>
+ % } }
+ </td>
+ </tr>
+@@
+ <td class="value">
+ % if ( $hash{DependedOnBy} ) {
+ % for my $link ( values %{$hash{DependedOnBy}} ) {
+- <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
+- <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& /Elements/ShowLink, URI => $link->BaseURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Base' &>
+ % } }
+ </td>
+ </tr>
+@@
+ <td class="value">
+ % if ( $hash{MemberOf} ) {
+ % for my $link ( values %{$hash{MemberOf}} ) {
+- <input type="checkbox" class="checkbox" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
+- <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& /Elements/ShowLink, URI => $link->TargetURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Target' &>
+ % } }
+ </td>
+ </tr>
+@@
+ <td class="value">
+ % if ( $hash{Members} ) {
+ % for my $link ( values %{$hash{Members}} ) {
+- <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
+- <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& /Elements/ShowLink, URI => $link->BaseURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Base' &>
+ % } }
+ </td>
+ </tr>
+@@
+ <td class="value">
+ % if ( $hash{RefersTo} ) {
+ % for my $link ( values %{$hash{RefersTo}} ) {
+- <input type="checkbox" class="checkbox" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
+- <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& /Elements/ShowLink, URI => $link->TargetURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Target' &>
+ % } }
+ </td>
+ </tr>
+@@
+ <td class="value">
+ % if ( $hash{ReferredToBy} ) {
+ % for my $link ( values %{$hash{ReferredToBy}} ) {
+-% # Skip reminders
+-% next if (UNIVERSAL::isa($link->BaseObj, 'RT::Ticket') && $link->BaseObj->Type eq 'reminder');
+- <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
+- <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& /Elements/ShowLink, URI => $link->BaseURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Base' &>
+ % } }
+ </td>
+ </tr>
+
+diff --git a/share/html/Elements/EditLink b/share/html/Elements/EditLink
+new file mode 100644
+--- /dev/null
++++ b/share/html/Elements/EditLink
+@@
++%# BEGIN BPS TAGGED BLOCK {{{
++%#
++%# COPYRIGHT:
++%#
++%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
++%# <sales at bestpractical.com>
++%#
++%# (Except where explicitly superseded by other copyright notices)
++%#
++%#
++%# LICENSE:
++%#
++%# This work is made available to you under the terms of Version 2 of
++%# the GNU General Public License. A copy of that license should have
++%# been provided with this software, but in any event can be snarfed
++%# from www.gnu.org.
++%#
++%# This work is distributed in the hope that it will be useful, but
++%# WITHOUT ANY WARRANTY; without even the implied warranty of
++%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++%# General Public License for more details.
++%#
++%# You should have received a copy of the GNU General Public License
++%# along with this program; if not, write to the Free Software
++%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
++%# 02110-1301 or visit their web page on the internet at
++%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
++%#
++%#
++%# CONTRIBUTION SUBMISSION POLICY:
++%#
++%# (The following paragraph is not intended to limit the rights granted
++%# to you to modify and distribute this software under the terms of
++%# the GNU General Public License and is only of importance to you if
++%# you choose to contribute your changes and enhancements to the
++%# community by submitting them to Best Practical Solutions, LLC.)
++%#
++%# By intentionally submitting any modifications, corrections or
++%# derivatives to this work, or any other work intended for use with
++%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
++%# you are the copyright holder for those contributions and you grant
++%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
++%# royalty-free, perpetual, license to use, copy, create derivative
++%# works based on those contributions, and sublicense and distribute
++%# those contributions and any derivatives thereof.
++%#
++%# END BPS TAGGED BLOCK }}}
++
++% if ( $Mode eq 'Target' ) {
++ <input type="checkbox" class="checkbox" id="DeleteLink--<%$Link->Type%>-<%$Link->Target%>" name="DeleteLink--<%$Link->Type%>-<%$Link->Target%>" value="1" />
++ <label for="DeleteLink--<%$Link->Type%>-<%$Link->Target%>"><& ShowLink, URI => $Link->TargetURI &></label>
++% } else {
++ <input type="checkbox" class="checkbox" id="DeleteLink-<%$Link->Base%>-<%$Link->Type%>-" name="DeleteLink-<%$Link->Base%>-<%$Link->Type%>-" value="1" />
++ <label for="DeleteLink-<%$Link->Base%>-<%$Link->Type%>-"><& ShowLink, URI => $Link->BaseURI &></label>
++% }
++
++<br />
++
++<%INIT>
++my $ModeObj = $Mode . 'Obj';
++return if UNIVERSAL::isa($Link->$ModeObj, 'RT::Article') && $Link->$ModeObj->Disabled;
++
++# Skip reminders
++return if $Mode eq 'Base' && $Link->Type eq 'RefersTo' && UNIVERSAL::isa($Link->BaseObj, 'RT::Ticket') && $Link->BaseObj->Type eq 'reminder';
++</%INIT>
++
++<%ARGS>
++$Link
++$Mode
++</%ARGS>
+
diff --git a/share/html/Elements/EditLinks b/share/html/Elements/EditLinks
--- a/share/html/Elements/EditLinks
+++ b/share/html/Elements/EditLinks
@@ -441,50 +571,64 @@
<td class="labeltop"><& ShowRelationLabel, Object => $Object, Label => loc('Depends on').':', Relation => 'DependsOn' &></td>
<td class="value">
% while (my $link = $Object->DependsOn->Next) {
-+% next if UNIVERSAL::isa($link->TargetObj, 'RT::Article') && $link->TargetObj->Disabled;
- <input type="checkbox" class="checkbox" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
- <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& ShowLink, URI => $link->TargetURI &></label><br />
- % }
+- <input type="checkbox" class="checkbox" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
+- <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& ShowLink, URI => $link->TargetURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Target' &>
+ % }
+ </td>
+ </tr>
@@
<td class="labeltop"><& ShowRelationLabel, Object => $Object, Label => loc('Depended on by').':', Relation => 'DependedOnBy' &></td>
<td class="value">
% while (my $link = $Object->DependedOnBy->Next) {
-+% next if UNIVERSAL::isa($link->BaseObj, 'RT::Article') && $link->BaseObj->Disabled;
- <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
- <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& ShowLink, URI => $link->BaseURI &></label><br />
- % }
+- <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
+- <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& ShowLink, URI => $link->BaseURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Base' &>
+ % }
+ </td>
+ </tr>
@@
<td class="labeltop"><& ShowRelationLabel, Object => $Object, Label => loc('Parents').':', Relation => 'Parents' &></td>
<td class="value">
% while (my $link = $Object->MemberOf->Next) {
-+% next if UNIVERSAL::isa($link->TargetObj, 'RT::Article') && $link->TargetObj->Disabled;
- <input type="checkbox" class="checkbox" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
- <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& ShowLink, URI => $link->TargetURI &></label><br />
- % }
+- <input type="checkbox" class="checkbox" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
+- <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& ShowLink, URI => $link->TargetURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Target' &>
+ % }
+ </td>
+ </tr>
@@
<td class="labeltop"><& ShowRelationLabel, Object => $Object, Label => loc('Children').':', Relation => 'Children' &></td>
<td class="value">
% while (my $link = $Object->Members->Next) {
-+% next if UNIVERSAL::isa($link->BaseObj, 'RT::Article') && $link->BaseObj->Disabled;
- <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
- <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& ShowLink, URI => $link->BaseURI &></label><br />
- % }
+- <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
+- <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& ShowLink, URI => $link->BaseURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Base' &>
+ % }
+ </td>
+ </tr>
@@
<td class="labeltop"><& ShowRelationLabel, Object => $Object, Label => loc('Refers to').':', Relation => 'RefersTo' &></td>
<td class="value">
% while (my $link = $Object->RefersTo->Next) {
-+% next if UNIVERSAL::isa($link->TargetObj, 'RT::Article') && $link->TargetObj->Disabled;
- <input type="checkbox" class="checkbox" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
- <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& ShowLink, URI => $link->TargetURI &></label><br />
+- <input type="checkbox" class="checkbox" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
+- <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& ShowLink, URI => $link->TargetURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Target' &>
%}
-@@
+ </td>
+ </tr>
+@@
+ <td class="labeltop"><& ShowRelationLabel, Object => $Object, Label => loc('Referred to by').':', Relation => 'ReferredToBy' &></td>
<td class="value">
% while (my $link = $Object->ReferredToBy->Next) {
- % # Skip reminders
-+% next if UNIVERSAL::isa($link->BaseObj, 'RT::Article') && $link->BaseObj->Disabled;
- % next if (UNIVERSAL::isa($link->BaseObj, 'RT::Ticket') && $link->BaseObj->Type eq 'reminder');
- <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
- <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& ShowLink, URI => $link->BaseURI &></label><br />
+-% # Skip reminders
+-% next if (UNIVERSAL::isa($link->BaseObj, 'RT::Ticket') && $link->BaseObj->Type eq 'reminder');
+- <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
+- <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& ShowLink, URI => $link->BaseURI &></label><br />
++ <& EditLink, Link => $link, Mode => 'Base' &>
+ % }
+ </td>
+ </tr>
diff --git a/share/html/Elements/ShowLinksOfType b/share/html/Elements/ShowLinksOfType
--- a/share/html/Elements/ShowLinksOfType
@@ -520,6 +664,43 @@
}
+diff --git a/share/html/m/ticket/show b/share/html/m/ticket/show
+--- a/share/html/m/ticket/show
++++ b/share/html/m/ticket/show
+@@
+ push( @active, $link->TargetURI );
+ }
+ }
+- else {
++ elsif ( not (UNIVERSAL::isa($link->TargetObj, 'RT::Article') && $link->TargetObj->Disabled) ) {
+ push( @not_tickets, $link->TargetURI );
+ }
+ }
+@@
+ <div class="value">
+ <ul>
+ % while (my $Link = $Ticket->DependedOnBy->Next) {
++% next if UNIVERSAL::isa($Link->BaseObj, 'RT::Article') && $Link->BaseObj->Disabled;
+ <li><& /Elements/ShowLink, URI => $Link->BaseURI &></li>
+ % }
+ </ul>
+@@
+ <div class="value">
+ <ul>
+ % while (my $Link = $Ticket->RefersTo->Next) {
++% next if UNIVERSAL::isa($Link->TargetObj, 'RT::Article') && $Link->TargetObj->Disabled;
+ <li><& /Elements/ShowLink, URI => $Link->TargetURI &></li>
+ % }
+ </ul>
+@@
+ <div class="value">
+ <ul>
+ % while (my $Link = $Ticket->ReferredToBy->Next) {
++% next if UNIVERSAL::isa($Link->BaseObj, 'RT::Article') && $Link->BaseObj->Disabled;
+ % next if (UNIVERSAL::isa($Link->BaseObj, 'RT::Ticket') && $Link->BaseObj->Type eq 'reminder');
+ <li><& /Elements/ShowLink, URI => $Link->BaseURI &></li>
+ % }
+
diff --git a/t/articles/article.t b/t/articles/article.t
--- a/t/articles/article.t
+++ b/t/articles/article.t
@@ -551,3 +732,4 @@
ok (!$uri->ParseURI("fsck.com-article://foo.com/article/$article_id"),
'ParseURI returned false with incorrect Organization');
+
-: ------- > 3: 53b293b hide reminders and disabled articles for REST
-: ------- > 4: 137ec67 hide reminders and disabled articles for ticket's relationship graph
-: ------- > 5: b89f38b distinguish links by prefixing scheme for non-ticket ids
More information about the rt-commit
mailing list