From 566759327ed15c6cde6dfb54a85113bff2daa0c0 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sat, 25 Dec 2021 18:03:21 +0200 Subject: [PATCH 01/17] AJAX: Add some code that can be reused to display AJAX request errors Also use this to add groups to the left menu --- Web/Presenters/OpenVKPresenter.php | 39 +++++++++++++++++++++++------- Web/Presenters/UserPresenter.php | 11 ++++----- Web/Presenters/WallPresenter.php | 2 +- Web/static/js/openvk.cls.js | 28 +++++++++++++++++++-- 4 files changed, 62 insertions(+), 18 deletions(-) diff --git a/Web/Presenters/OpenVKPresenter.php b/Web/Presenters/OpenVKPresenter.php index 18a7c14b..9bb60313 100755 --- a/Web/Presenters/OpenVKPresenter.php +++ b/Web/Presenters/OpenVKPresenter.php @@ -39,14 +39,26 @@ abstract class OpenVKPresenter extends SimplePresenter Session::i()->set("_tempTheme", $theme); } - protected function flashFail(string $type, string $title, ?string $message = NULL, ?int $code = NULL): void + protected function flashFail(string $type, string $title, ?string $message = NULL, ?int $code = NULL, bool $json = false): void { - $this->flash($type, $title, $message, $code); - $referer = $_SERVER["HTTP_REFERER"] ?? "/"; - - header("HTTP/1.1 302 Found"); - header("Location: $referer"); - exit; + if($json) { + $this->returnJson([ + "success" => $type !== "err", + "flash" => [ + "type" => $type, + "title" => $title, + "message" => $message, + "code" => $code, + ], + ]); + } else { + $this->flash($type, $title, $message, $code); + $referer = $_SERVER["HTTP_REFERER"] ?? "/"; + + header("HTTP/1.1 302 Found"); + header("Location: $referer"); + exit; + } } protected function logInUserWithToken(): void @@ -120,7 +132,7 @@ abstract class OpenVKPresenter extends SimplePresenter $this->flashFail("err", tr("captcha_error"), tr("captcha_error_comment")); } - protected function willExecuteWriteAction(): void + protected function willExecuteWriteAction(bool $json = false): void { $ip = (new IPs)->get(CONNECTING_IP); $res = $ip->rateLimit(); @@ -131,7 +143,7 @@ abstract class OpenVKPresenter extends SimplePresenter exit("Хакеры? Интересно..."); } - $this->flashFail("err", tr("rate_limit_error"), tr("rate_limit_error_comment", OPENVK_ROOT_CONF["openvk"]["appearance"]["name"], $res)); + $this->flashFail("err", tr("rate_limit_error"), tr("rate_limit_error_comment", OPENVK_ROOT_CONF["openvk"]["appearance"]["name"], $res), NULL, $json); } } @@ -241,4 +253,13 @@ abstract class OpenVKPresenter extends SimplePresenter Session::i()->set("_error", NULL); } } + + protected function returnJson(array $json): void + { + $payload = json_encode($json); + $size = strlen($payload); + header("Content-Type: application/json"); + header("Content-Length: $size"); + exit($payload); + } } diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 8bb33d50..3c559cf3 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -101,11 +101,11 @@ final class UserPresenter extends OpenVKPresenter $this->notFound(); if(!$club->canBeModifiedBy($this->user->identity ?? NULL)) - $this->flashFail("err", "Ошибка доступа", "У вас недостаточно прав, чтобы изменять этот ресурс."); + $this->flashFail("err", "Ошибка доступа", "У вас недостаточно прав, чтобы изменять этот ресурс.", NULL, true); $isClubPinned = $this->user->identity->isClubPinned($club); if(!$isClubPinned && $this->user->identity->getPinnedClubCount() > 10) - $this->flashFail("err", "Ошибка", "Находится в левом меню могут максимум 10 групп"); + $this->flashFail("err", "Ошибка", "Находится в левом меню могут максимум 10 групп", NULL, true); if($club->getOwner()->getId() === $this->user->identity->getId()) { $club->setOwner_Club_Pinned(!$isClubPinned); @@ -118,10 +118,9 @@ final class UserPresenter extends OpenVKPresenter } } - if($isClubPinned) - $this->flashFail("succ", "Операция успешна", "Группа " . $club->getName() . " была успешно удалена из левого меню"); - else - $this->flashFail("succ", "Операция успешна", "Группа " . $club->getName() . " была успешно добавлена в левое меню"); + $this->returnJson([ + "success" => true + ]); } function renderEdit(): void diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index acb8f633..999bf53c 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -320,7 +320,7 @@ final class WallPresenter extends OpenVKPresenter (new RepostNotification($post->getOwner(false), $post, $this->user->identity))->emit(); }; - exit(json_encode(["wall_owner" => $this->user->identity->getId()])); + $this->returnJson(["wall_owner" => $this->user->identity->getId()]); } function renderDelete(int $wall, int $post_id): void diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js index 6d80626e..974a8aca 100644 --- a/Web/static/js/openvk.cls.js +++ b/Web/static/js/openvk.cls.js @@ -38,6 +38,22 @@ function hidePanel(panel, count = 0) } +function parseAjaxResponse(responseString) { + try { + const response = JSON.parse(responseString); + if(response.flash) + NewNotification(response.flash.title, response.flash.message || "", null); + + return response.success || false; + } catch(error) { + if(responseString === "Хакеры? Интересно...") { + location.reload(); + return false; + } else { + throw error; + } + } +} document.addEventListener("DOMContentLoaded", function() { //BEGIN @@ -100,6 +116,15 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN let req = await ky(link); if(req.ok == false) { NewNotification(tr('error'), tr('error_1'), null); + thisButton.nodes[0].classList.remove('loading'); + thisButton.nodes[0].classList.remove('disable'); + return; + } + + if(!parseAjaxResponse(await req.text())) { + thisButton.nodes[0].classList.remove('loading'); + thisButton.nodes[0].classList.remove('disable'); + return; } // Adding a divider if not already there @@ -145,7 +170,7 @@ function repostPost(id, hash) { xhr.open("POST", "/wall"+id+"/repost?hash="+hash, true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.onload = (function() { - if(xhr.responseText.indexOf("wall_owner") === -1) + if(xhr.responseText.indexOf("wall_owner") === -1) MessageBox(tr('error'), tr('error_repost_fail'), tr('ok'), [Function.noop]); else { let jsonR = JSON.parse(xhr.responseText); @@ -222,4 +247,3 @@ function showCoinsTransferDialog(coinsCount, hash) { Function.noop ]); } - From 19a2325a25a0c7b0eb119c03ac2e5692283571ec Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sat, 25 Dec 2021 19:47:18 +0200 Subject: [PATCH 02/17] Users: Do not reload page when changing status through a popup --- Web/Presenters/UserPresenter.php | 11 ++++++----- Web/Presenters/templates/User/View.xml | 26 +++++++++++++++++++++++--- Web/static/css/style.css | 12 ++++++++++-- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 3c559cf3..8066f11e 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -134,7 +134,7 @@ final class UserPresenter extends OpenVKPresenter $user = $this->users->get($id); if($_SERVER["REQUEST_METHOD"] === "POST") { - $this->willExecuteWriteAction(); + $this->willExecuteWriteAction($_GET['act'] === "status"); if($_GET['act'] === "main" || $_GET['act'] == NULL) { $user->setFirst_Name(empty($this->postParam("first_name")) ? $user->getFirstName() : $this->postParam("first_name")); @@ -196,15 +196,15 @@ final class UserPresenter extends OpenVKPresenter } elseif($_GET['act'] === "status") { if(mb_strlen($this->postParam("status")) > 255) { $statusLength = (string) mb_strlen($this->postParam("status")); - $this->flashFail("err", "Ошибка", "Статус слишком длинный ($statusLength символов вместо 255 символов)"); + $this->flashFail("err", "Ошибка", "Статус слишком длинный ($statusLength символов вместо 255 символов)", NULL, true); } $user->setStatus(empty($this->postParam("status")) ? NULL : $this->postParam("status")); $user->save(); - header("HTTP/1.1 302 Found"); - header("Location: /id" . $user->getId()); - exit; + $this->returnJson([ + "success" => true + ]); } try { @@ -376,6 +376,7 @@ final class UserPresenter extends OpenVKPresenter "menu_grupoj" => "groups", "menu_novajoj" => "news", "menu_ligiloj" => "links", + "menu_audioj" => "audios", ]; foreach($settings as $checkbox => $setting) $user->setLeftMenuItemStatus($setting, $this->checkbox($checkbox)); diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index 46a50eb6..261a92fa 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -316,12 +316,12 @@
{$alert}
{var thatIsThisUser = isset($thisUser) && $user->getId() == $thisUser->getId()}
@@ -543,7 +543,7 @@ } -
diff --git a/Web/static/css/style.css b/Web/static/css/style.css index 067d4eac..564b850a 100644 --- a/Web/static/css/style.css +++ b/Web/static/css/style.css @@ -416,7 +416,7 @@ table { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);; padding: 10px; float: right; - margin-top: 5px; + margin-top: 6px; margin-left: -6px; } @@ -440,7 +440,15 @@ table { } .button:hover { - color: #e8e8e8; + color: #e8e8e8; +} + +.button-loading { + display: inline-block; + background-image: url('/assets/packages/static/openvk/img/loading_mini.gif'); + width: 30px; + height: 7px; + margin-left: -3px; } input[class=button] { From a3167ab828b66ea689cbb6077c014049f463cc16 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sat, 25 Dec 2021 19:58:34 +0200 Subject: [PATCH 03/17] Fixup "Users: Do not reload page when changing status through a popup" :3 --- Web/Presenters/templates/User/View.xml | 4 +++- Web/static/css/style.css | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index 261a92fa..1ad941f4 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -321,7 +321,7 @@ - +
@@ -546,6 +546,8 @@
From 7b4d30328d37c8b0e0216f52719e86fdb532cc75 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sun, 26 Dec 2021 00:02:07 +0200 Subject: [PATCH 06/17] Users: Work fine with empty statuses --- Web/Presenters/templates/User/View.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index 43855b95..17bbf6c3 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -574,7 +574,14 @@ return; } - document.querySelector("#page_status_text").innerHTML = status; + if(document.status_popup_form.status.value === "") { + document.querySelector("#page_status_text").innerHTML = `[ ${tr("change_status")} ]`; + document.querySelector("#page_status_text").className = "edit_link page_status_edit_button"; + } else { + document.querySelector("#page_status_text").innerHTML = status; + document.querySelector("#page_status_text").className = "page_status page_status_edit_button"; + } + setStatusEditorShown(false); document.status_popup_form.submit.innerHTML = tr("send"); document.status_popup_form.submit.disabled = false; From a5f0deefc24d9bc1c8fb41150eec5ffdd845002d Mon Sep 17 00:00:00 2001 From: Dmitry <72506029+HSDChannel@users.noreply.github.com> Date: Sun, 26 Dec 2021 17:49:46 +0700 Subject: [PATCH 07/17] Update centos8_install.md (#364) --- docs/centos8_install.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/centos8_install.md b/docs/centos8_install.md index 97437858..f29ebc67 100644 --- a/docs/centos8_install.md +++ b/docs/centos8_install.md @@ -2,6 +2,10 @@ Based on [@rem-pai](https://github.com/rem-pai)'s way to install OpenVK modified using my experience. +!!WARNING!! + +CentOS 8 is reaching it's end-of-life soon. There are other supported similar distributions like Rocky Linux or AlmaLinux. + ## SELinux 🖥Run the command: From 579b2fb0dd880cc690f1acebd92bc4b4c99c169c Mon Sep 17 00:00:00 2001 From: Ilya Prokopenko Date: Sun, 26 Dec 2021 18:05:22 +0700 Subject: [PATCH 08/17] Posts: Ability to hide Share and Like buttons Moved from 8f8d7bb --- .../components/post/microblogpost.xml | 52 +++++++++++-------- .../templates/components/post/oldpost.xml | 44 +++++++++------- 2 files changed, 54 insertions(+), 42 deletions(-) diff --git a/Web/Presenters/templates/components/post/microblogpost.xml b/Web/Presenters/templates/components/post/microblogpost.xml index 8c22b51b..b5893981 100644 --- a/Web/Presenters/templates/components/post/microblogpost.xml +++ b/Web/Presenters/templates/components/post/microblogpost.xml @@ -99,34 +99,40 @@ {/if} {/if} -
- {if $commentsCount > 3} - {_view_other_comments} - {/if} - {foreach $comments as $comment} - {include "../comment.xml", comment => $comment, $compact => true} - {/foreach} -
- {var commentsURL = "/al_comments.pl/create/posts/" . $post->getId()} - {include "../textArea.xml", route => $commentsURL, postOpts => false, graffiti => (bool) ovkGetQuirk("comments.allow-graffiti"), post => $post} + {if !($forceNoCommentsLink ?? false)} +
+ {if $commentsCount > 3} + {_view_other_comments} + {/if} + {foreach $comments as $comment} + {include "../comment.xml", comment => $comment, $compact => true} + {/foreach} +
+ {var commentsURL = "/al_comments.pl/create/posts/" . $post->getId()} + {include "../textArea.xml", route => $commentsURL, postOpts => false, graffiti => (bool) ovkGetQuirk("comments.allow-graffiti"), post => $post} +
-
+ {/if} diff --git a/Web/Presenters/templates/components/post/oldpost.xml b/Web/Presenters/templates/components/post/oldpost.xml index ad256ff9..f59a9cf7 100644 --- a/Web/Presenters/templates/components/post/oldpost.xml +++ b/Web/Presenters/templates/components/post/oldpost.xml @@ -91,29 +91,35 @@ {_"comments"} {/if} + {/if} + + {if !($forceNoCommentsLink ?? false) && !($forceNoShareLink ?? false)}  |  {/if} - - {if $post->getRepostCount() > 0} - {_"share"} - ({$post->getRepostCount()}) - {else} - {_"share"} - {/if} - - - - + {/if} + + {if !($forceNoLike ?? false)} + + {/if}
From 91429437f83fd75e995148fd6317c6147a573e3d Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sun, 26 Dec 2021 14:24:15 +0200 Subject: [PATCH 09/17] Users: Make it easier to enter votes vouchers Automatically switch fields and fill all fields on paste --- Web/Presenters/templates/User/Settings.xml | 34 ++++++++++++++++++---- Web/static/js/openvk.cls.js | 18 ++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/Web/Presenters/templates/User/Settings.xml b/Web/Presenters/templates/User/Settings.xml index daa7a0c3..f142a5e3 100644 --- a/Web/Presenters/templates/User/Settings.xml +++ b/Web/Presenters/templates/User/Settings.xml @@ -348,16 +348,40 @@ {elseif $isFinanceTU}

{_voucher_explanation} {_voucher_explanation_ex}

-
- - - - - - - + + - + - + - +

+ {elseif $isInterface} diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js index 974a8aca..9d819d6b 100644 --- a/Web/static/js/openvk.cls.js +++ b/Web/static/js/openvk.cls.js @@ -247,3 +247,21 @@ function showCoinsTransferDialog(coinsCount, hash) { Function.noop ]); } + +function chunkSubstr(string, size) { + const numChunks = Math.ceil(string.length / size); + const chunks = new Array(numChunks); + + for (let i = 0, o = 0; i < numChunks; ++i, o += size) { + chunks[i] = string.substr(o, size); + } + + return chunks; +} + +function autoTab(original, next, previous) { + if(original.getAttribute && original.value.length == original.getAttribute("maxlength") && next !== undefined) + next.focus(); + else if(original.value.length == 0 && previous !== undefined) + previous.focus(); +} From 08c4d961f18456848a4b1bd741a47b94d4b0a837 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko <50026114+maksalees@users.noreply.github.com> Date: Sun, 26 Dec 2021 16:06:57 +0200 Subject: [PATCH 10/17] Users: Fix saving settings :3 --- Web/Presenters/UserPresenter.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Web/Presenters/UserPresenter.php b/Web/Presenters/UserPresenter.php index 8066f11e..43f4100d 100644 --- a/Web/Presenters/UserPresenter.php +++ b/Web/Presenters/UserPresenter.php @@ -376,7 +376,6 @@ final class UserPresenter extends OpenVKPresenter "menu_grupoj" => "groups", "menu_novajoj" => "news", "menu_ligiloj" => "links", - "menu_audioj" => "audios", ]; foreach($settings as $checkbox => $setting) $user->setLeftMenuItemStatus($setting, $this->checkbox($checkbox)); From 33836d8a2ec6001fcf2c4a9be523869cd027d5f0 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sun, 26 Dec 2021 16:16:37 +0200 Subject: [PATCH 11/17] Groups: Publish group avatars uploaded by hidden administrator as anonymous --- Web/Presenters/GroupPresenter.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Web/Presenters/GroupPresenter.php b/Web/Presenters/GroupPresenter.php index 7788c09e..7b9a20f2 100644 --- a/Web/Presenters/GroupPresenter.php +++ b/Web/Presenters/GroupPresenter.php @@ -219,10 +219,17 @@ final class GroupPresenter extends OpenVKPresenter if($_FILES["ava"]["error"] === UPLOAD_ERR_OK) { $photo = new Photo; try { + $anon = OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["anonymousPosting"]["enable"]; + if($anon && $this->user->id === $club->getOwner()->getId()) + $anon = $club->isOwnerHidden(); + else if($anon) + $anon = $club->getManager($this->user->identity)->isHidden(); + $photo->setOwner($this->user->id); $photo->setDescription("Profile image"); $photo->setFile($_FILES["ava"]); $photo->setCreated(time()); + $photo->setAnonymous($anon); $photo->save(); (new Albums)->getClubAvatarAlbum($club)->addPhoto($photo); From 9d89a67a913703608f0a9eed06a4393e8488d844 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sun, 26 Dec 2021 19:15:32 +0200 Subject: [PATCH 12/17] Support: Ability to respond with configurable quick replies to tickets --- Web/Presenters/SupportPresenter.php | 7 ++-- .../templates/Support/AnswerTicket.xml | 36 +++++++++++++------ Web/static/css/style.css | 13 +++++++ Web/static/js/openvk.cls.js | 24 +++++++++++++ locales/en.strings | 3 ++ locales/ru.strings | 3 ++ openvk-example.yml | 4 +++ 7 files changed, 76 insertions(+), 14 deletions(-) diff --git a/Web/Presenters/SupportPresenter.php b/Web/Presenters/SupportPresenter.php index e34eecab..a94fe855 100644 --- a/Web/Presenters/SupportPresenter.php +++ b/Web/Presenters/SupportPresenter.php @@ -164,9 +164,10 @@ final class SupportPresenter extends OpenVKPresenter $this->notFound(); $ticketComments = $this->comments->getCommentsById($id); - $this->template->ticket = $ticket; - $this->template->comments = $ticketComments; - $this->template->id = $id; + $this->template->ticket = $ticket; + $this->template->comments = $ticketComments; + $this->template->id = $id; + $this->template->fastAnswers = OPENVK_ROOT_CONF["openvk"]["preferences"]["support"]["fastAnswers"]; } function renderAnswerTicketReply(int $id): void diff --git a/Web/Presenters/templates/Support/AnswerTicket.xml b/Web/Presenters/templates/Support/AnswerTicket.xml index 7ca11217..043c8ecc 100644 --- a/Web/Presenters/templates/Support/AnswerTicket.xml +++ b/Web/Presenters/templates/Support/AnswerTicket.xml @@ -24,18 +24,24 @@

- +
-
- - +
+
+ + +
+ +

@@ -93,17 +99,17 @@ {tr("support_greeting_hi", $ticket->getUser()->getFullName())}

- + {$comment->getText()|noescape}

- + {tr("support_greeting_regards", OPENVK_ROOT_CONF["openvk"]["appearance"]["name"])|noescape} {else} {$comment->getText()|noescape} {/if} - + {if $comment->getUType() === 0}
{_delete} @@ -126,4 +132,12 @@ + + {/block} diff --git a/Web/static/css/style.css b/Web/static/css/style.css index 01c0648e..d26fb93f 100644 --- a/Web/static/css/style.css +++ b/Web/static/css/style.css @@ -1776,3 +1776,16 @@ body.scrolled .toTop:hover { margin: -20px; padding: 10px; } + +.hover-box { + background-color: white; + padding: 10px; + margin: 5px; + border: 1px solid #C0CAD5; + cursor: pointer; + user-select: none; +} + +.hover-box:hover { + background-color: #C0CAD5; +} diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js index 9d819d6b..9c5a4c50 100644 --- a/Web/static/js/openvk.cls.js +++ b/Web/static/js/openvk.cls.js @@ -265,3 +265,27 @@ function autoTab(original, next, previous) { else if(original.value.length == 0 && previous !== undefined) previous.focus(); } + +function showSupportFastAnswerDialog(answers) { + let html = ""; + for(const [index, answer] of Object.entries(answers)) { + html += ` +
+ ${answer.replace(/\n/g, "
")} +
+ `; + } + + MessageBox(tr("fast_answers"), html, [tr("close")], [ + Function.noop + ]); +} + +function supportFastAnswerDialogOnClick(answer) { + u("body").removeClass("dimmed"); + u(".ovk-diag-cont").remove(); + + const answerInput = document.querySelector("#answer_text"); + answerInput.value = answer; + answerInput.focus(); +} diff --git a/locales/en.strings b/locales/en.strings index 8410abf7..0d2431a5 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -610,6 +610,8 @@ "support_rated_bad" = "You left a negative feedback about the answer."; "wrong_parameters" = "Invalid request parameters."; +"fast_answers" = "Fast answers"; + "comment" = "Comment"; "sender" = "Sender"; @@ -764,6 +766,7 @@ "cancel" = "Cancel"; "edit_action" = "Change"; "transfer" = "Transfer"; +"close" = "Close"; "warning" = "Warning"; "question_confirm" = "This action can't be undone. Do you really wanna do it?"; diff --git a/locales/ru.strings b/locales/ru.strings index 3e90c5c5..6ed93397 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -639,6 +639,8 @@ "support_rated_bad" = "Вы оставили негативный отзыв об ответе."; "wrong_parameters" = "Неверные параметры запроса."; +"fast_answers" = "Быстрые ответы"; + "comment" = "Комментарий"; "sender" = "Отправитель"; @@ -799,6 +801,7 @@ "cancel" = "Отмена"; "edit_action" = "Изменить"; "transfer" = "Передать"; +"close" = "Закрыть"; "warning" = "Внимание"; "question_confirm" = "Это действие нельзя отменить. Вы действительно уверены в том что хотите сделать?"; diff --git a/openvk-example.yml b/openvk-example.yml index 441afd19..0f8a9b55 100644 --- a/openvk-example.yml +++ b/openvk-example.yml @@ -31,6 +31,10 @@ openvk: support: supportName: "Moderator" adminAccount: 1 # Change this ok + fastAnswers: + - "This is a list of quick answers to common questions for support. Post your responses here and agents can send it quickly with just 3 clicks" + - "There can be as many answers as you want, but it is best to have a maximum of 10.\n\nYou can also remove all answers from the list to disable this feature" + - "Good luck filling! If you are a regular support agent, inform the administrator that he forgot to fill the config" messages: strict: false wall: From 83aec243935a6b38a3cf977ebd11d8841e33ec7f Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Sun, 26 Dec 2021 20:52:35 +0200 Subject: [PATCH 13/17] Groups: Add a button to manage a group from the admin panel to the group page --- Web/Presenters/templates/Group/View.xml | 3 +++ locales/en.strings | 1 + locales/ru.strings | 1 + 3 files changed, 5 insertions(+) diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index a817b72c..980fe554 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -98,6 +98,9 @@ {if $club->canBeModifiedBy($thisUser)} {_"edit_group"} {/if} + {if $thisUser->getChandlerUser()->can("access")->model("admin")->whichBelongsTo(NULL)} + {_"manage_group_action"} + {/if} {if $club->getSubscriptionStatus($thisUser) == false}
diff --git a/locales/en.strings b/locales/en.strings index 0d2431a5..d143f5ab 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -745,6 +745,7 @@ "login_as" = "Login as $1"; "manage_user_action" = "Manage user"; +"manage_group_action" = "Manage group"; "ban_user_action" = "Ban user"; "warn_user_action" = "Warn user"; diff --git a/locales/ru.strings b/locales/ru.strings index 6ed93397..e743d236 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -780,6 +780,7 @@ "login_as" = "Войти как $1"; "manage_user_action" = "Управление пользователем"; +"manage_group_action" = "Управление группой"; "ban_user_action" = "Заблокировать пользователя"; "warn_user_action" = "Предупредить пользователя"; From 337ede5db09013ad4c25d0ed515b068e3e834af8 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko <50026114+maksalees@users.noreply.github.com> Date: Sun, 26 Dec 2021 23:31:54 +0200 Subject: [PATCH 14/17] Fix syntax error in SQL dump --- install/sqls/00004-kromer-typechange.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/sqls/00004-kromer-typechange.sql b/install/sqls/00004-kromer-typechange.sql index 15449bc6..aa3aef6a 100644 --- a/install/sqls/00004-kromer-typechange.sql +++ b/install/sqls/00004-kromer-typechange.sql @@ -1 +1 @@ -ALTER TABLE `profiles` CHANGE `coins` `coins` REAL(20) UNSIGNED NOT NULL DEFAULT '0'; \ No newline at end of file +ALTER TABLE `profiles` CHANGE `coins` `coins` REAL UNSIGNED NOT NULL DEFAULT '0'; From 0b848e35ee693c0d902b13e9ef309913cf6ad2e8 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Mon, 27 Dec 2021 00:11:35 +0200 Subject: [PATCH 15/17] Auth: Do not require a surname upon registration --- Web/Presenters/templates/Auth/Register.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Web/Presenters/templates/Auth/Register.xml b/Web/Presenters/templates/Auth/Register.xml index 90ae6053..bf6ba594 100644 --- a/Web/Presenters/templates/Auth/Register.xml +++ b/Web/Presenters/templates/Auth/Register.xml @@ -39,7 +39,7 @@ {_"surname"}: - + From 19796d5ca81143d67f3751d9f2f54177efa40881 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Mon, 27 Dec 2021 13:08:20 +0200 Subject: [PATCH 16/17] Groups: Display group anonymous avatar link as anonymous --- Web/Presenters/templates/Group/View.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index 980fe554..7699a1f7 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -91,7 +91,9 @@ {presenter "openvk!Wall->wallEmbedded", -$club->getId()}
- + {var avatarPhoto = $club->getAvatarPhoto()} + {var avatarLink = ($avatarPhoto->isAnonymous() ? "/photo" . ("s/" . base_convert((string) $avatarPhoto->getId(), 10, 32)) : $club->getAvatarLink())} +
{var avatarPhoto = $club->getAvatarPhoto()} - {var avatarLink = ($avatarPhoto->isAnonymous() ? "/photo" . ("s/" . base_convert((string) $avatarPhoto->getId(), 10, 32)) : $club->getAvatarLink())} + {var avatarLink = ((is_null($avatarPhoto) ? FALSE : $avatarPhoto->isAnonymous()) ? "/photo" . ("s/" . base_convert((string) $avatarPhoto->getId(), 10, 32)) : $club->getAvatarLink())}