I’ve been poking at the TicketTimer helper, trying to make it use the same rich text box as the Ticket Update page (by removing Type => ‘text/plain’ from the /Elements/MessageBox element). The time submits properly, but the comment does not.
My folks are used to being able to do rich text comments, so this is a bit of a less-than-ideal situation.
Anyone have an idea for what else I should poke at?
What happens if you set type to text/html
?
Sadly, the same thing. The time is recorded but the comment is not.
Both of the red transactions had associated comments in the Timer popup
Ah I am guessing the issue is around getting the comment content in JavaScript land in TicketTimer:
var Payload = {
id: <% $Ticket->id %>,
seconds: CommittedSeconds,
comment: jQuery('#Comment').val()
};
I suspect you’re correct.
I ramped up logging and saw this request when I did a plain text message box:
10.228.64.144 - - [03/Aug/2020:12:29:18 -0400] “GET /Helpers/AddTimeWorked?id=324016&seconds=63&comment=Test HTTP/1.1” 200 40 “https://10.228.64.144/Helpers/TicketTimer?id=324016” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 Edg/84.0.522.52”
With a rich text box, I saw this: 10.228.64.144 - - [03/Aug/2020:12:27:19 -0400] “GET /Helpers/AddTimeWorked?id=324016&seconds=62&comment= HTTP/1.1” 200 40 “https://10.228.64.144/Helpers/TicketTimer?id=324016” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36 Edg/84.0.522.52”
The difference is the text from the rich text box doesn’t get passed as a comment to /Helpers/AddTimeWorked.
And that’s about all I can figure out at this time.
A quick test looks like something like this could work:
diff --git a/share/html/Helpers/TicketTimer b/share/html/Helpers/TicketTimer
index 440797dcd..35217d7aa 100644
--- a/share/html/Helpers/TicketTimer
+++ b/share/html/Helpers/TicketTimer
@@ -139,10 +139,18 @@ jQuery( function() {
jQuery('.control-line a').hide();
CommittedSeconds += CurrentSeconds();
+
+ var comment;
+ if ( <%RT->Config->Get('MessageBoxRichText', $session{'CurrentUser'})%> ) {
+ comment = CKEDITOR.instances['Comment'].getData();
+ }
+ else {
+ comment = jQuery('#Comment').val();
+ }
var Payload = {
id: <% $Ticket->id %>,
seconds: CommittedSeconds,
- comment: jQuery('#Comment').val()
+ comment: comment
};
Readout.text('<% loc("Submitting") %>');
But I didn’t test too much