Neue Verwaltung der Gruppenzuordnung 1:n
This commit is contained in:
1 parent
fa02a7ade0
commit
02c017d53d
34 files changed
+1306
-251
No files matched your search
@@ -9,6 +9,7 @@ const storageKey = `cmbnet:${tenant}:mobile`;
|
||||
const viewMode = window.CMBNET_VIEW_MODE || 'mobile_dispatcher';
|
||||
const currentAccountId = Number(window.CMBNET_ACCOUNT_ID) || null;
|
||||
const currentRole = window.CMBNET_ROLE || null;
|
||||
const appTitle = window.CMBNET_APP_TITLE || '20*C+M+B+27';
|
||||
|
||||
const DEFAULT_SETTINGS = {
|
||||
opacity: 0.7,
|
||||
@@ -248,7 +249,7 @@ async function requestNotifications() {
|
||||
if (permission === 'granted' && navigator.serviceWorker) {
|
||||
const registration = await navigator.serviceWorker.getRegistration();
|
||||
if (registration && registration.showNotification) {
|
||||
await registration.showNotification('CMBNet', {
|
||||
await registration.showNotification(appTitle, {
|
||||
body: 'Benachrichtigungen sind aktiviert.',
|
||||
icon: window.CMBNET_ICON_URL || undefined,
|
||||
tag: 'cmbnet-permission'
|
||||
@@ -395,7 +396,11 @@ function groupDisplayName(group) {
|
||||
|
||||
function findGroupForAccount(accountId) {
|
||||
const id = Number(accountId);
|
||||
return state.groups.find(group => Number(group.account_id) === id) || null;
|
||||
if (!Number.isFinite(id)) return null;
|
||||
return state.groups.find(group =>
|
||||
Array.isArray(group.account_ids)
|
||||
&& group.account_ids.some(value => Number(value) === id)
|
||||
) || null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,8 +495,7 @@ function getReceiverName(message, payload) {
|
||||
group = state.groups[0];
|
||||
}
|
||||
if (group) {
|
||||
const accountName = getAccountDisplayName(group.account_id);
|
||||
return accountName || groupDisplayName(group) || 'Gruppe';
|
||||
return groupDisplayName(group) || 'Gruppe';
|
||||
}
|
||||
|
||||
const accountName = getAccountDisplayName(receiverId);
|
||||
@@ -927,11 +931,11 @@ async function showChatPopup(text, senderName) {
|
||||
if (navigator.serviceWorker) {
|
||||
const registration = await navigator.serviceWorker.getRegistration();
|
||||
if (registration && registration.showNotification) {
|
||||
await registration.showNotification(senderName || 'CMBNet', options);
|
||||
await registration.showNotification(senderName || appTitle, options);
|
||||
return;
|
||||
}
|
||||
}
|
||||
new Notification(senderName || 'CMBNet', options);
|
||||
new Notification(senderName || appTitle, options);
|
||||
} catch (error) {
|
||||
// Benachrichtigungen sind optional.
|
||||
}
|
||||
@@ -983,6 +987,15 @@ function handleWs(event) {
|
||||
if (state.ws && state.ws.readyState === WebSocket.OPEN) {
|
||||
state.ws.send(JSON.stringify({code: 2, msg: 'pong'}));
|
||||
}
|
||||
} else if (message.code === 99) {
|
||||
const text = typeof message.msg === 'string'
|
||||
? message.msg
|
||||
: extractText(message.msg);
|
||||
if (typeof window.showReloadNotice === 'function') {
|
||||
window.showReloadNotice(text);
|
||||
} else {
|
||||
alert(`${text}\n\nBitte die Webseite neu laden.`);
|
||||
}
|
||||
} else if (message.code === 100) {
|
||||
// Street update
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user