Флаг client_read_receipts: не вызывать POST /read по умолчанию (убирает 404 в консоли)
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@
|
||||
<name>f7support</name>
|
||||
<summary>Support ticket client for F7cloud (F7cloud-compatible)</summary>
|
||||
<description>f7support client app for creating and viewing support tickets.</description>
|
||||
<version>0.1.1</version>
|
||||
<version>0.1.2</version>
|
||||
<licence>AGPL</licence>
|
||||
<author>f7support team</author>
|
||||
<namespace>F7Support</namespace>
|
||||
|
||||
+3
-1
@@ -6,6 +6,8 @@
|
||||
const serverAddress = root.dataset.serverAddress;
|
||||
const apiBase = root.dataset.supportApiBase;
|
||||
const supportWsBaseOverride = (root.dataset.supportWsBase || "").trim();
|
||||
/** Включается в NC: `occ config:app:set f7support client_read_receipts --value=1` после выката API `POST .../read`. */
|
||||
const clientReadReceiptsEnabled = root.dataset.clientReadReceipts === "1";
|
||||
|
||||
const RASTER_IMAGE_EXT = new Set(["jpg", "jpeg", "png", "gif", "webp", "bmp", "tif", "tiff", "heic", "heif"]);
|
||||
const RASTER_IMAGE_MIME = new Set([
|
||||
@@ -264,7 +266,7 @@
|
||||
}
|
||||
|
||||
async function markClientTicketRead(ticketNumber) {
|
||||
if (skipClientReadReceiptPost || !ticketNumber) return;
|
||||
if (!clientReadReceiptsEnabled || skipClientReadReceiptPost || !ticketNumber) return;
|
||||
let res;
|
||||
try {
|
||||
res = await fetch(`${apiBase}/api/client/tickets/${encodeURIComponent(ticketNumber)}/read`, {
|
||||
|
||||
@@ -39,6 +39,10 @@ class PageController extends Controller {
|
||||
// Optional full WebSocket URL prefix, e.g. wss://support.f7cloud.ru/api/ws (path before /tickets/{id})
|
||||
$supportWsBase = $this->config->getAppValue('f7support', 'support_ws_base', '');
|
||||
|
||||
// POST /api/client/tickets/{id}/read — только если бэкенд уже выкатили (иначе 404 и шум в консоли NC).
|
||||
// Включение: occ config:app:set f7support client_read_receipts --value=1
|
||||
$clientReadReceipts = $this->config->getAppValue('f7support', 'client_read_receipts', '0');
|
||||
|
||||
Util::addStyle('f7support', 'f7support');
|
||||
Util::addScript('f7support', 'main');
|
||||
|
||||
@@ -48,6 +52,7 @@ class PageController extends Controller {
|
||||
'supportApiBase' => $supportApiBase,
|
||||
'supportApiOrigin' => $supportApiOrigin,
|
||||
'supportWsBase' => $supportWsBase,
|
||||
'clientReadReceipts' => $clientReadReceipts,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
data-server-address="<?php p($_['serverAddress']); ?>"
|
||||
data-support-api-base="<?php p($_['supportApiBase']); ?>"
|
||||
data-support-ws-base="<?php p($_['supportWsBase'] ?? ''); ?>"
|
||||
data-client-read-receipts="<?php p($_['clientReadReceipts'] ?? '0'); ?>"
|
||||
data-messages-poll-ms="5000">
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user