Skip to content
3 changes: 2 additions & 1 deletion docs/mobile-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ in there:
| `login` | Whether sign-in is available (false in open mode) |
| `loginProviders` | The configured logins, for example `["discord", "fluxer"]`; empty when `login` is false |
| `platforms` | The platforms the bot runs on, for example `["discord"]` |
| `features` | What this version's app API supports, so the app can hide what an older Sylo lacks. Today: `app-login`, `live-access`, `changelog`, `collectibles`, `welcome-trigger`, `member-search`, `access-levels`, `health`, `app-connect`, `setup-wizard`, `config-history`, `inbox-search`, `config-import`, `duplicate`, `message-templates` and `message-move`, plus `push` and `push-pigeon` when this instance can send notifications. See the list below |
| `features` | What this version's app API supports, so the app can hide what an older Sylo lacks. Today: `app-login`, `live-access`, `changelog`, `collectibles`, `welcome-trigger`, `member-search`, `access-levels`, `health`, `app-connect`, `setup-wizard`, `config-history`, `inbox-search`, `config-import`, `duplicate`, `message-templates`, `message-move` and `moderator-view`, plus `push` and `push-pigeon` when this instance can send notifications. See the list below |

The feature strings:

Expand All @@ -338,6 +338,7 @@ The feature strings:
- `duplicate`: the `duplicate` routes for reminders, embed messages, reaction-role sets, custom commands and shop items.
- `message-templates`: the built-in message templates and the raw message JSON import and export.
- `message-move`: when the channel of a posted **embed message**, the **Welcome channel** message or a **role panel** changes and is published, the server posts a fresh message in the new channel, stores it and then deletes the old one, so the app must not unpublish first. Other bot posts (verification, honeypot traps, applications and so on) are not covered. A publish that loses a race with another publish of the same embed message answers `409` with the current record.
- `moderator-view`: the web dashboard gives a person whose level in a server is `inbox` a focused view: the server opens on the inbox, and the navigation lists only the moderation tools (Tickets, Appeals, Applications, Suggestions, Moderation hub, Member data; only the inboxes that are switched on), with a "Show everything" switch for the full, still locked, navigation. Nothing changes on the server side: the level is the `access` of each `GET /api/v2/guilds` entry (and `level` of `GET /api/v2/guilds/:id/access`). The app can follow the same rules for that level and keeps the full read-only app for `view`.
- `app-connect`: [adding the other login](#adding-the-other-login). Only where sign-in is on and both Discord and Fluxer logins are set up.
- `push`, `push-pigeon`: this instance can send notifications to signed-in apps.

Expand Down
7 changes: 6 additions & 1 deletion docs/self-hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,12 @@ require **Manage Server** (or Administrator / owner) in that server, or one of t
roles set under *Dashboard access* on that server's *Settings* page: **Edit**
(the bot-master roles: everything), **Inbox** (tickets, ban appeals, applications
and suggestions, and reading the rest) or **View** (the pages and settings, read
only, without what the inboxes contain). Only the owner or someone with Manage
only, without what the inboxes contain). A person with Inbox access gets a focused
dashboard: the server opens on the first inbox that is switched on, and the sidebar lists only the moderation
tools (the inboxes that are switched on: Tickets, Appeals, Applications,
Suggestions; and the Moderation hub and Member data); a "Show everything" switch at the top of the sidebar brings back the full, still
locked, navigation and is remembered in that browser. View and Edit see the full
dashboard. Only the owner or someone with Manage
Server can change the Edit roles; anyone with Edit can change the Inbox and View
roles and save the rest of that page. With `INTENT_GUILD_MEMBERS=false` Sylo
fetches a member from Discord before their role decides access (on every change,
Expand Down
3 changes: 3 additions & 0 deletions src/web/routes/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ export const mobileApiRouter = Router();
// sign-in is on and both Discord and Fluxer logins are set up. `access-levels`: View / Inbox / Edit
// dashboard access, with `access` on each GET /api/v2/guilds entry and GET/POST
// /api/v2/guilds/:id/access. `message-move`: a posted message moves to its new channel on publish.
// `moderator-view`: the web dashboard's focused view for Inbox-level access (landing on the inbox, only the
// moderation tools); the app can follow it with `access` from GET /api/v2/guilds.
const FEATURES = Object.freeze([
'app-login',
'live-access',
Expand All @@ -328,6 +330,7 @@ const FEATURES = Object.freeze([
'duplicate',
'message-templates',
'message-move',
'moderator-view',
]);

// Public and ahead of the open-mode guard: the app calls it before anyone signs in, and an open-mode
Expand Down
1 change: 1 addition & 0 deletions test/mobileInfo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ test('GET /api/mobile/info describes a server with login on, without a cookie or
assert.ok(info.features.includes(f), f);
}
assert.ok(info.features.includes('message-move'), 'a posted message moves when its channel changes');
assert.ok(info.features.includes('moderator-view'), 'the focused moderator view for Inbox access');
assert.ok(info.features.every((f) => typeof f === 'string'));
});

Expand Down
4 changes: 2 additions & 2 deletions web-v2/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import MemberShell from './components/MemberShell.jsx';
import RouteError from './components/RouteError.jsx';
import NotFound from './components/NotFound.jsx';
import GuildPicker from './pages/GuildPicker.jsx';
import Overview from './pages/Overview.jsx';
import GuildHome from './pages/GuildHome.jsx';
const Leaderboard = lazy(() => import('./pages/Leaderboard.jsx'));
const Settings = lazy(() => import('./pages/Settings.jsx'));
const Personalizer = lazy(() => import('./pages/Personalizer.jsx'));
Expand Down Expand Up @@ -63,7 +63,7 @@ const router = createBrowserRouter(
<Route element={<Shell />} errorElement={<RouteError />}>
<Route errorElement={<RouteError />}>
<Route index element={<GuildPicker />} />
<Route path="guilds/:guildId" element={<Overview />} />
<Route path="guilds/:guildId" element={<GuildHome />} />
<Route path="guilds/:guildId/leaderboard" element={<Leaderboard />} />
<Route path="guilds/:guildId/settings" element={<Settings />} />
<Route path="guilds/:guildId/audit" element={<AuditLog />} />
Expand Down
38 changes: 38 additions & 0 deletions web-v2/src/__tests__/inboxPages.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import TicketsInbox from '../pages/TicketsInbox.jsx';
import TicketView from '../pages/TicketView.jsx';
import AppealsReview from '../pages/AppealsReview.jsx';
import { AccessProvider } from '../access.jsx';

vi.mock('../api.js', () => ({
ApiError: class ApiError extends Error {},
Expand All @@ -15,6 +16,7 @@ vi.mock('../api.js', () => ({
ticketTranscriptUrl: (g, id) => `/api/v2/guilds/${g}/tickets/${id}/transcript`,
getAppealsReview: vi.fn(),
decideAppeal: vi.fn(),
getGuildAccess: vi.fn(),
}));
vi.mock('../notify.js', () => ({ notify: vi.fn() }));
vi.mock('../components/ConfirmDialog.jsx', () => ({ confirmDialog: vi.fn().mockResolvedValue(true) }));
Expand Down Expand Up @@ -60,6 +62,21 @@ describe('TicketsInbox', () => {
const link = await screen.findByRole('link', { name: /settings/i });
expect(link.getAttribute('href')).toBe(`/guilds/${GUILD}/m/tickets`);
});

it('has no link to the ticket settings for Inbox access: that page is locked for them', async () => {
api.getGuildAccess.mockResolvedValue({ level: 'inbox' });
api.getTickets.mockResolvedValue({ open: [], closed: [] });
renderAt(
`/guilds/${GUILD}/tickets`,
'guilds/:guildId/tickets',
<AccessProvider guildId={GUILD} hint="inbox">
<TicketsInbox />
</AccessProvider>
);
await screen.findByRole('heading', { name: 'Tickets' });
await waitFor(() => expect(api.getGuildAccess).toHaveBeenCalled());
expect(screen.queryByRole('link', { name: /settings/i })).toBeNull();
});
});

describe('TicketView', () => {
Expand Down Expand Up @@ -133,4 +150,25 @@ describe('AppealsReview', () => {
`/guilds/${GUILD}/m/appeals`
);
});

it('has no link to the appeal settings for Inbox access, and tells them who can set it up', async () => {
api.getGuildAccess.mockResolvedValue({ level: 'inbox' });
api.getAppealsReview.mockResolvedValue({
moduleEnabled: true,
configured: false,
open: 0,
appeals: [],
});
renderAt(
`/guilds/${GUILD}/appeals`,
'guilds/:guildId/appeals',
<AccessProvider guildId={GUILD} hint="inbox">
<AppealsReview />
</AccessProvider>
);
await screen.findByText(/No appeal questions are set up yet/);
await waitFor(() => expect(api.getGuildAccess).toHaveBeenCalled());
expect(screen.queryByRole('link', { name: /Appeal settings/ })).toBeNull();
expect(screen.getByText(/Ask a server admin to set it up\./)).toBeTruthy();
});
});
Loading
Loading