[Bps-public-commit] rt-extension-rest2 branch, master, updated. 1.07-29-g77e6be3
? sunnavy
sunnavy at bestpractical.com
Fri May 1 13:12:17 EDT 2020
The branch, master has been updated
via 77e6be3eca589a1d7bcef2adec78854b7a56eae7 (commit)
from 70462dec601086b3e3fbc1cfc0bc15a4b5b6195d (commit)
Summary of changes:
lib/RT/Extension/REST2/Resource/Ticket.pm | 1 +
xt/tickets.t | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
- Log -----------------------------------------------------------------
commit 77e6be3eca589a1d7bcef2adec78854b7a56eae7
Author: Andrew Ruthven <puck at catalystcloud.nz>
Date: Tue Oct 29 04:24:20 2019 +0000
Set the Subject on the create attachment
Previously the Subject isn't being passed into the MIME Entity which
is create for the Attachment of the create Transaction. This change
makes the REST2 API consistent with the other Create methods.
diff --git a/lib/RT/Extension/REST2/Resource/Ticket.pm b/lib/RT/Extension/REST2/Resource/Ticket.pm
index 3f2f751..f8cf37a 100644
--- a/lib/RT/Extension/REST2/Resource/Ticket.pm
+++ b/lib/RT/Extension/REST2/Resource/Ticket.pm
@@ -46,6 +46,7 @@ sub create_record {
if ( defined $data->{Content} ) {
$data->{MIMEObj} = HTML::Mason::Commands::MakeMIMEEntity(
Interface => 'REST',
+ Subject => $data->{Subject},
Body => delete $data->{Content},
Type => delete $data->{ContentType} || 'text/plain',
);
diff --git a/xt/tickets.t b/xt/tickets.t
index 695d9a4..2261bde 100644
--- a/xt/tickets.t
+++ b/xt/tickets.t
@@ -155,6 +155,22 @@ my ($ticket_url, $ticket_id);
$user->PrincipalObj->RevokeRight(Right => 'SeeQueue');
}
+# Ticket Create Attachment created correctly
+{
+ my $ticket = RT::Ticket->new($user);
+ $ticket->Load($ticket_id);
+ my $transaction_id = $ticket->Transactions->Last->id;
+ my $attachments = $ticket->Attachments->ItemsArrayRef;
+
+ # 1 attachment
+ is(scalar(@$attachments), 1);
+
+ is($attachments->[0]->Parent, 0);
+ is($attachments->[0]->Subject, 'Ticket creation using REST');
+ ok(!$attachments->[0]->Filename);
+ is($attachments->[0]->ContentType, 'text/plain');
+}
+
# Ticket Search
{
my $res = $mech->get("$rest_base_path/tickets?query=id>0",
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list