Fix blank Server/Channel Gruppen tabs when the group list can't load

servergrouplist/channelgrouplist decline silently on the server when the
account lacks permission to see them (no reply at all - same behavior as
banlist/complainlist elsewhere in this app). The permissions editor's
group list only rendered when it had data, so a permission-limited
account just saw a permanently blank left panel with no explanation
(reported by a screenshot from the real server).

Added the same loading/6s-timeout/"nicht verfügbar" fallback every other
list dialog in this app already uses (GroupAssignDialog, banlist, etc.) -
now shows a loading indicator, then a clear "unavailable" message
instead of nothing.

Verified in demo mode: both Server Gruppen and Channel Gruppen tabs still
list their (demo) groups correctly - no regression from the loading-state
change.
This commit is contained in:
Moepchi committed 2026-08-06 01:50:53 +02:00
1 parent ecc07308f6
commit b4ec2a26b6
1 file changed
+37 -18
+37 -18
View File
@@ -2072,7 +2072,19 @@ function PermissionsEditorDialog({
const [addNegated, setAddNegated] = useState(false);
const [addSkip, setAddSkip] = useState(false);
const isGroupScope = scope === "server" || scope === "channelgroup";
const groupList = scope === "server" ? serverGroups : scope === "channelgroup" ? channelGroups : null;
// The channelgrouplist/servergrouplist requests decline silently when the
// account lacks the permission to see them (no reply at all, same as
// banlist/complainlist elsewhere) - without this, a permission-limited
// account just sees a permanently blank panel with no explanation.
const [groupsTimedOut, setGroupsTimedOut] = useState(false);
useEffect(() => {
setGroupsTimedOut(false);
if (groupList) return;
const id = window.setTimeout(() => setGroupsTimedOut(true), 6000);
return () => window.clearTimeout(id);
}, [groupList]);
// (ids, ready) for the currently selected target under the active tab -
// ready is false while a required piece (channel/client) hasn't been picked yet.
@@ -2146,24 +2158,31 @@ function PermissionsEditorDialog({
</div>
<div className="ts-dialog-body ts-perms-editor-body">
<div className="ts-perms-editor-picker">
{groupList && (
<ul className="ts-perms-editor-list">
{groupList.length === 0 && <li className="ts-perms-editor-list-empty">{t("groupAssign.empty")}</li>}
{groupList.map((g) => (
<li key={g.id}>
<button
className={`ts-link-button${groupId === g.id ? " ts-perms-editor-selected" : ""}`}
onClick={() => {
setGroupId(g.id);
load({ scope, groupId: g.id });
}}
>
{g.name}
</button>
</li>
))}
</ul>
)}
{isGroupScope &&
(groupList ? (
<ul className="ts-perms-editor-list">
{groupList.length === 0 && (
<li className="ts-perms-editor-list-empty">{t("groupAssign.empty")}</li>
)}
{groupList.map((g) => (
<li key={g.id}>
<button
className={`ts-link-button${groupId === g.id ? " ts-perms-editor-selected" : ""}`}
onClick={() => {
setGroupId(g.id);
load({ scope, groupId: g.id });
}}
>
{g.name}
</button>
</li>
))}
</ul>
) : (
<div className="ts-connection-info-loading">
{groupsTimedOut ? t("connectionInfo.unavailable") : t("connectionInfo.loading")}
</div>
))}
{(scope === "channel" || scope === "channelclient") && (
<ul className="ts-perms-editor-list">
{channels.map((c) => (