Rewrite unholy and annoying support greetings

This commit is contained in:
Celestora 2021-11-25 21:20:52 +02:00
parent d1f0dea73a
commit 131988ddf3
5 changed files with 39 additions and 6 deletions

View file

@ -181,7 +181,7 @@ final class SupportPresenter extends OpenVKPresenter
$comment = new TicketComment; $comment = new TicketComment;
$comment->setUser_id($this->user->id); $comment->setUser_id($this->user->id);
$comment->setUser_type(1); $comment->setUser_type(1);
$comment->setText('Здравствуйте, '.$ticket->getUser()->getFirstName().'!<br></br>'.$this->postParam("text").'<br></br>С уважением,<br/> Команда поддержки OpenVK.'); $comment->setText($this->postParam("text"));
$comment->setTicket_id($id); $comment->setTicket_id($id);
$comment->setCreated(time()); $comment->setCreated(time());
$comment->save(); $comment->save();

View file

@ -40,6 +40,7 @@
</div> </div>
<br/> <br/>
<p n:if="!$comments">Комментарии отсутствуют</p> <p n:if="!$comments">Комментарии отсутствуют</p>
{var $printedSupportGreeting = false}
<table n:foreach="$comments as $comment" border="0" style="font-size: 11px;" class="post"> <table n:foreach="$comments as $comment" border="0" style="font-size: 11px;" class="post">
<tbody> <tbody>
<tr> <tr>
@ -82,8 +83,22 @@
{/if} {/if}
<div class="post-content" id="{$comment->getId()}"> <div class="post-content" id="{$comment->getId()}">
<div class="text" id="text{$comment->getId()}"> <div class="text" id="text{$comment->getId()}">
{if $comment->getUType() === 1 && !$printedSupportGreeting)
{var $printedSupportGreeting = true}
{_support_greeting_hi}, {$ticket->getUser()->getFullName()}!
<br/>
<br/>
{$comment->getText()|noescape} {$comment->getText()|noescape}
<br/>
<br/>
{_support_greeting_regargs} {=OPENVK_ROOT_CONF["openvk"]["appearance"]["name"]}.
{else}
{$comment->getText()|noescape}
{/if}
</div> </div>
{if $comment->getUType() === 0} {if $comment->getUType() === 0}
<div class="post-menu"> <div class="post-menu">
<a href="/support/comment/{$comment->getId()}/delete">Удалить</a> <a href="/support/comment/{$comment->getId()}/delete">Удалить</a>

View file

@ -39,6 +39,7 @@
{/if} {/if}
</br> </br>
<p n:if="!$comments">Комментарии отсутствуют</p> <p n:if="!$comments">Комментарии отсутствуют</p>
{var $printedSupportGreeting = false}
<table n:foreach="$comments as $comment" border="0" style="font-size: 11px;" class="post"> <table n:foreach="$comments as $comment" border="0" style="font-size: 11px;" class="post">
<tbody> <tbody>
<tr> <tr>
@ -74,7 +75,20 @@
{/if} {/if}
<div class="post-content" id="{$comment->getId()}"> <div class="post-content" id="{$comment->getId()}">
<div class="text" id="text{$comment->getId()}"> <div class="text" id="text{$comment->getId()}">
{if $comment->getUType() === 1 && !$printedSupportGreeting)
{var $printedSupportGreeting = true}
{_support_greeting_hi}, {$ticket->getUser()->getFullName()}!
<br/>
<br/>
{$comment->getText()|noescape} {$comment->getText()|noescape}
<br/>
<br/>
{_support_greeting_regargs} {=OPENVK_ROOT_CONF["openvk"]["appearance"]["name"]}.
{else}
{$comment->getText()|noescape}
{/if}
</div> </div>
{if $comment->getUType() === 0} {if $comment->getUType() === 0}
<div class="post-menu"> <div class="post-menu">

View file

@ -0,0 +1 @@
UPDATE `tickets_comments` SET `text`=REGEXP_REPLACE(`text`, "(?:Здравствуйте, [^!]*!<br><\/br>|<br><\/br>С уважением,<br\/> Команда поддержки OpenVK.)", "") WHERE 1=1;

View file

@ -528,6 +528,9 @@
"coins_many" = "$1 голосов"; "coins_many" = "$1 голосов";
"coins_other" = "$1 голосов"; "coins_other" = "$1 голосов";
"support_greeting_hi" = "Здравствуйте";
"support_greeting_regargs" = "С уважением,<br/>команда поддержки";
"comment" = "Комментарий"; "comment" = "Комментарий";
"sender" = "Отправитель"; "sender" = "Отправитель";