Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use editor when creating ticket from profile dropdown initialize with agent signature details if available #490

Merged
merged 2 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Controller/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function saveTicket(Request $request)
'subject' => $ticketProxy->getSubject(),
// @TODO: We need to enable support for html messages.
// Our focus here instead should be to prevent XSS (filter js)
'message' => strip_tags($ticketProxy->getReply()),
'message' => str_replace(['<script>', '</script>'], '', htmlspecialchars($ticketProxy->getReply())),
'firstName' => $customer->getFirstName(),
'lastName' => $customer->getLastName(),
'type' => $ticketProxy->getType(),
Expand Down
25 changes: 23 additions & 2 deletions Resources/views/Snippets/createMemberTicket.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<div class="uv-element-block">
<label class="uv-field-label">{{ 'Message'|trans }}</label>
<div class="uv-field-block">
<textarea name="reply" class="uv-field create-ticket" type="text"></textarea>
<textarea name="reply" id="create-reply" class="uv-field create-ticket" type="text">{{ ticket_service.getAgentDraftReply() }}</textarea>
</div>

<span class="uv-field-info">{{ 'Ticket query message'|trans }}</span>
Expand Down Expand Up @@ -382,6 +382,7 @@
var validationParameters = true;
</script>
{% endif %}
{{ include("@UVDeskSupportCenter/Templates/tinyMCE.html.twig") }}

<script type="text/javascript">
$(function () {
Expand Down Expand Up @@ -433,13 +434,33 @@
msg : "{{ 'This field is mandatory'|trans }}"
},
'reply' : {
required : true,
fn: function(value) {
if(!tinyMCE.get("uv-edit-create-thread"))
return false;
var html = tinyMCE.get("uv-edit-create-thread").getContent();
if(app.appView.stripHTML(html) != '') {
return false;
}
return true;
},
msg : "{{ 'This field is mandatory'|trans }}"
},
}),
urlRoot : "{{ path('helpdesk_member_create_ticket') }}"
});

sfTinyMce.init({
height: '155px',
selector : '#create-reply',
images_upload_url: "",
setup: function(editor) {
},
plugins: [
],
toolbar: '| undo redo | bold italic forecolor ',
statusbar: false,
});

var CreateTicketForm = Backbone.View.extend({
el : $("#create-ticket-modal #create-ticket-form"),
model: new CreateTicketModel(),
Expand Down