[Rt-commit] rt branch, 4.6/article-refactor, repushed
? sunnavy
sunnavy at bestpractical.com
Tue Nov 6 17:11:28 EST 2018
The branch 4.6/article-refactor was deleted and repushed:
was 4f3ed5dce9505b5ab5fa0ba8dce2acd00517c1f5
now bfc3233657f1265e8f65b5ed59c0860e1b132bd5
1: 0e2c89047 ! 1: cfb23fd15 Add default value for Articles in Queues
@@ -47,7 +47,7 @@
&>
+
+ <tr><td class="label"><&|/l&>Article</&>:</td>
-+ <td><& /Elements/SelectArticle, QueueObj => $queue, DefaultArticle => $queue->DefaultValue('Article') &>
++ <td><& /Elements/SelectArticle, QueueObj => $queue, Default => $queue->DefaultValue('Article'), Name => 'Article' &>
+ </td></tr>
+
</table>
@@ -139,7 +139,7 @@
+%#
+%# COPYRIGHT:
+%#
-+%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
++%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
@@ -186,7 +186,7 @@
+<select name="<% $Name %>">
+<option value="">-</option>
+% while (my $article = $articles->Next) {
-+<option <% ( $article->Name eq $DefaultArticle) ? qq[ selected="selected"] : '' |n %>
++<option <% ( $article->Name eq $Default) ? qq[ selected="selected"] : '' |n %>
+ value="<%$article->Id%>"
+><% $article->Name %></option>
+% }
@@ -201,24 +201,25 @@
+
+my $autocomplete = $articles->Count > $dropdown_limit ? 1 : 0;
+
-+if ( $DefaultArticle and $DefaultArticle =~ /^\d+$/ ){
++if ( $Default and $Default =~ /^\d+$/ ){
+ # We got an id, look up the name
+ my $default_article = RT::Article->new($session{'CurrentUser'});
-+ my ($ret, $msg) = $default_article->Load( $DefaultArticle );
++ my ($ret, $msg) = $default_article->Load( $Default );
+
+ if ($ret) {
-+ $DefaultArticle = $default_article->Name;
++ $Default = $default_article->Name;
+ }
+ else {
-+ RT::Logger->error("Unable to load article $DefaultArticle: $msg");
-+ $DefaultArticle = '';
-+ }
-+}
++ RT::Logger->error("Unable to load article $Default: $msg");
++ }
++}
++
++$Default //= '';
+</%INIT>
+
+<%ARGS>
+$QueueObj
-+$ArticleSelectName => 'Article'
-+$DefaultArticle => ''
++$Name => 'Article'
++$Default => ''
+</%ARGS>
2: dd0f7cb14 ! 2: a287e701f Add autocomplete for articles
@@ -10,7 +10,7 @@
%# END BPS TAGGED BLOCK }}}
+% if ( $autocomplete ) {
-+<& "SelectArticleAutocomplete", QueueObj => $QueueObj, Default => $DefaultArticle, Name => $ArticleSelectName &>
++<& "SelectArticleAutocomplete", QueueObj => $QueueObj, Default => $Default, Name => $Name &>
+% } else {
<select name="<% $Name %>">
<option value="">-</option>
@@ -33,7 +33,7 @@
+%#
+%# COPYRIGHT:
+%#
-+%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
++%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
@@ -93,7 +93,7 @@
+%#
+%# COPYRIGHT:
+%#
-+%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
++%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
3: 0f33bf654 = 3: da505e97e Test default article content on ticket create
4: 75edfaca3 ! 4: b37c96760 Push default article loading toward create
@@ -11,7 +11,7 @@
<textarea autocomplete="off" class="messagebox <% $Type eq 'text/html' ? 'richtext' : '' %>" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>" placeholder="<% $Placeholder %>">
-% $m->comp('/Articles/Elements/IncludeArticle', %ARGS) if $IncludeArticle;
+% $m->comp('/Articles/Elements/IncludeArticle', %ARGS, ArticleId => $article_id) if $IncludeArticle;
- % $m->callback( %ARGS, SignatureRef => \$signature, DefaultRef => \$Default, MessageRef => $message );
+ % $m->callback( %ARGS, SignatureRef => \$signature, DefaultRef => \$Default, MessageRef => \$message );
% if (RT->Config->Get("SignatureAboveQuote", $session{'CurrentUser'})) {
<% $Default || '' %><% $signature %><% $message %></textarea>
@@
5: bf48ed214 ! 5: e8893c27b Refactor ticket create and update to use new SelectArticle
@@ -27,10 +27,9 @@
-<tr>
<td><&|/l&>Include Article:</&></td>
-<td><input size=20 name="<% $name_prefix %>Articles-Include-Article-Named" /></td>
-+<td><& /Elements/SelectArticle, QueueObj => $QueueObj, AutoSubmit => 1 &></td>
- <td><input type="submit" name="Go" value="Go" /></td>
- </tr>
- % }
+-<td><input type="submit" name="Go" value="Go" /></td>
+-</tr>
+-% }
-% if ($hotlist->Count) {
-<tr>
-<td><&|/l&>Select an Article to include</&></td>
@@ -59,11 +58,10 @@
-<td> </td>
-<td><%$article->Name || loc('(no name)')%>: <%$article->Summary || ''%></td>
-<td><input type="submit" name="<% $name_prefix %>Articles-Include-Article-<%$article->Id%>" value="Go" /></td>
--</tr>
--% }
++<td><& /Elements/SelectArticle, QueueObj => $QueueObj, AutoSubmit => 1 &></td>
+ </tr>
+ % }
% if ( @$topics ) {
- <tr>
- <td>
@@
<&|/l, $included_topic->Name &>Select an Article from [_1]</&>
</td>
@@ -82,7 +80,7 @@
%# END BPS TAGGED BLOCK }}}
<%INIT>
+# Nothing to do if we don't get an article id
-+$IncludeArticleId //= $ARGS{'IncludeArticleId'};
++$IncludeArticleId //= $DECODED_ARGS->{'IncludeArticleId'};
+return unless $IncludeArticleId;
-my $parent_args = $m->caller_args(-1);
@@ -177,7 +175,7 @@
<textarea autocomplete="off" class="messagebox <% $Type eq 'text/html' ? 'richtext' : '' %>" <% $width_attr %>="<% $Width %>" rows="<% $Height %>" <% $wrap_type |n %> name="<% $Name %>" id="<% $Name %>" placeholder="<% $Placeholder %>">
-% $m->comp('/Articles/Elements/IncludeArticle', %ARGS, ArticleId => $article_id) if $IncludeArticle;
+% $m->comp('/Articles/Elements/IncludeArticle', %ARGS, IncludeArticleId => $article_id) if $IncludeArticle;
- % $m->callback( %ARGS, SignatureRef => \$signature, DefaultRef => \$Default, MessageRef => $message );
+ % $m->callback( %ARGS, SignatureRef => \$signature, DefaultRef => \$Default, MessageRef => \$message );
% if (RT->Config->Get("SignatureAboveQuote", $session{'CurrentUser'})) {
<% $Default || '' %><% $signature %><% $message %></textarea>
@@
@@ -208,13 +206,13 @@
+++ b/share/html/Elements/SelectArticle
@@
% if ( $autocomplete ) {
- <& "SelectArticleAutocomplete", QueueObj => $QueueObj, Default => $DefaultArticle, Name => $ArticleSelectName &>
+ <& "SelectArticleAutocomplete", QueueObj => $QueueObj, Default => $Default, Name => $Name &>
% } else {
-<select name="<% $Name %>">
-+<select name="<% $ArticleSelectName %>" <% $AutoSubmit ? 'onchange="this.form.submit()"' : '' |n%>>
++<select name="<% $Name %>" <% $AutoSubmit ? 'onchange="this.form.submit()"' : '' |n%>>
<option value="">-</option>
% while (my $article = $articles->Next) {
- <option <% ( $article->Name eq $DefaultArticle) ? qq[ selected="selected"] : '' |n %>
+ <option <% ( $article->Name eq $Default) ? qq[ selected="selected"] : '' |n %>
- value="<%$article->Id%>"
-><% $article->Name %></option>
+ value="<%$article->Id%>">
@@ -227,12 +225,12 @@
<%ARGS>
$QueueObj
--$ArticleSelectName => 'Article'
--$DefaultArticle => ''
-+$ArticleSelectName => 'IncludeArticleId'
-+$DefaultArticle => ''
-+$AutoSubmit => 0
-+$IncludeSummary => 1
+-$Name => 'Article'
+-$Default => ''
++$Name => 'IncludeArticleId'
++$Default => ''
++$AutoSubmit => 0
++$IncludeSummary => 1
</%ARGS>
diff --git a/share/html/Elements/SelectArticleAutocomplete b/share/html/Elements/SelectArticleAutocomplete
@@ -329,8 +327,8 @@
$m->submit_form(
form_number => 3,
- fields => { 'Articles-Include-Article-Named' => 'article foo' },
+- button => 'Go',
+ fields => { 'IncludeArticleId' => '1' },
- button => 'Go',
);
$m->content_like( qr/article foo.*article foo/s, 'selected article foo' );
- $m->content_unlike( qr/article bar.*article bar/s, 'no article bar' );
@@ -357,8 +355,50 @@
diag "update ticket to see if there are both article foo and bar"
@@
+ $m->submit_form(
+ form_number => 3,
+ fields => { 'Articles_Content' => 'article' },
+- button => 'Go',
+ );
+ $m->content_lacks( 'article foo', 'no article foo' );
$m->content_lacks( 'article bar', 'no article bar' );
+@@
+ $m->submit_form(
+ form_number => 3,
+ fields => { 'Articles-Include-Article-Named' => 'article foo' },
+- button => 'Go',
+ );
+ $m->content_lacks( 'article foo', 'no article foo' );
+ $m->content_lacks( 'article bar', 'no article bar' );
+@@
+ $m->submit_form(
+ form_number => 3,
+ fields => { 'Articles-Include-Article-Named' => 'article bar' },
+- button => 'Go',
+ );
+ $m->content_lacks( 'article foo', 'no article foo' );
+ $m->content_lacks( 'article bar', 'no article bar' );
}
+done_testing();
+diff --git a/t/articles/set-subject.t b/t/articles/set-subject.t
+--- a/t/articles/set-subject.t
++++ b/t/articles/set-subject.t
+@@
+ $m->submit_form(
+ form_number => 3,
+ fields => { 'Articles-Include-Article-Named' => $article->Id },
+- button => 'Go',
+ );
+ is($m->form_number(3)->find_input('UpdateSubject')->value,$ticket->Subject,'Ticket Subject Not Clobbered');
+
+@@
+ $m->submit_form(
+ form_number => 3,
+ fields => { 'Articles-Include-Article-Named' => $article->Name },
+- button => 'Go',
+ );
+ is($m->form_number(3)->find_input('UpdateSubject')->value,$article->FirstCustomFieldValue("Subject-$$"),'Ticket Subject Clobbered');
+
+
6: d21aafd9e = 6: 3e142bfc1 Add articles notes to upgrading docs
7: bebc696c7 = 7: 4b0149720 Remove article loading now handled in SelectArticle
8: 07d60e912 = 8: 5652cbd63 Update article to ticket linking with new args
9: 4f3ed5dce ! 9: fc6a8f84f Update tests for new articles configuration
@@ -17,20 +17,14 @@
$m->content_like( qr/Article \d+ created/, "created article $name" );
@@
+ form_number => 3,
fields => { 'IncludeArticleId' => '1' },
- button => 'Go',
);
- $m->content_like( qr/article foo.*article foo/s, 'selected article foo' );
+ $m->content_like( qr/foo summary/s, 'article included' );
}
-@@
- $m->content_lacks( 'article bar', 'no article bar' );
- }
-
-+undef $m;
- done_testing();
diff --git a/t/web/articles-links.t b/t/web/articles-links.t
--- a/t/web/articles-links.t
@@ -44,3 +38,4 @@
$m->submit;
$m->content_contains('instance of ticket #17421', 'got the name of the article in the ticket');
+
--: ------- > 10: 06480e703 Drop the hacky hidden "SubmitTicket" input on ticket create page
--: ------- > 11: bfc323365 Drop class HotList
More information about the rt-commit
mailing list