1
0
Fork 0

feat(polls): add polls and poll-votes collections

A unit-wide poll raised by an NPC conversation, plus the ballots behind it.

- `polls` snapshots the authored question, options (stable keys), closesAt,
  multi-select, anonymity, role eligibility, weight tiers, result flag and the
  Discord message reference. Writes are closed at the collection level: the
  dialogue effect creates one and every later change goes through the service.
- `sourceKey` (`<dialogueId>:<nodeId>`) is unique, which makes the dialogue
  trigger idempotent: a second player joins the existing poll instead of
  opening a rival one, and later node edits never rewrite a poll people voted in.
- `poll-votes` is one ballot per voter (unique poll+user) with read access
  limited to the superuser tier. That gate is what keeps an anonymous poll
  anonymous: members read counts, never identities.
- New `Polls` permission group and the `polls` event-log target.
This commit is contained in:
Jason Fraley 2026-12-01 14:17:32 -05:00
parent bf9fd09752
commit 9c49e52c8a
10 changed files with 97386 additions and 1 deletions

View file

@ -0,0 +1,73 @@
import type { CollectionConfig } from "payload";
import { requirePermission } from "@/utils/access-control/hasPermission";
/**
* One ballot per voter per poll (unique poll+user). Votes are updatable until
* the poll closes; the poll service rewrites the row in place, so a voter can
* change or retract their answer.
*
* Weight is deliberately NOT stored: it is resolved from the voter's roles when
* the poll closes, then frozen into `polls.outcome`. That keeps one source of
* truth for "who counts double" and makes the tie set a superuser is asked
* about stable while the decision is pending.
*
* Read access is the anonymity guarantee: only the superuser tier can read
* vote rows. Everyone else sees counts, which the service computes with
* `overrideAccess`. Writes are service-only, the same posture as
* `tech-ballot-votes`.
*/
export const PollVotes: CollectionConfig = {
slug: "poll-votes",
admin: {
group: "Polls",
defaultColumns: ["poll", "user", "updatedAt"],
description:
"Ballots. Readable only by the superuser tier, which is what keeps anonymous polls anonymous for everyone else.",
},
access: {
read: requirePermission("system:admin-access"),
create: () => false,
update: () => false,
delete: () => false,
},
indexes: [
{
fields: ["poll", "user"],
unique: true,
},
],
fields: [
{
name: "poll",
type: "relationship",
relationTo: "polls",
required: true,
index: true,
},
{
name: "user",
type: "relationship",
relationTo: "users",
required: true,
index: true,
},
{
name: "answers",
type: "array",
required: true,
minRows: 1,
maxRows: 10,
admin: {
description:
"The option keys this voter chose. One row on a single-answer poll; the service dedupes and rejects keys the poll does not carry.",
},
fields: [
{
name: "key",
type: "text",
required: true,
},
],
},
],
};

View file

@ -0,0 +1,319 @@
import type { CollectionConfig } from "payload";
/**
* A unit-wide poll raised by an NPC conversation.
*
* Writes are closed at the collection level: the dialogue effect creates one,
* and every later change (vote, close, tie decision) goes through the poll
* service with `overrideAccess`. The admin panel is a read-only history, which
* is the same posture as `tech-ballots`.
*
* `sourceKey` (`<dialogueId>:<nodeId>`) makes the trigger idempotent: a second
* player reaching the same node joins the existing poll instead of opening a
* new one. The option list and settings are copied out of the dialogue node at
* launch, so editing the node afterwards cannot rewrite a poll people have
* already voted in.
*/
export const Polls: CollectionConfig = {
slug: "polls",
admin: {
group: "Polls",
useAsTitle: "title",
defaultColumns: ["title", "status", "closesAt", "winnerKey"],
description:
"Unit-wide polls raised by NPC conversations. Read-only here: they are created by the dialogue effect and resolved by the poll service.",
},
access: {
read: ({ req }) => Boolean(req.user),
create: () => false,
update: () => false,
delete: () => false,
},
indexes: [
{ fields: ["sourceKey"], unique: true },
{ fields: ["status"] },
],
hooks: {
beforeValidate: [
({ data }) => {
const options = (data?.options ?? []) as { key?: unknown }[];
const seen = new Set<string>();
for (const option of options) {
const key = typeof option.key === "string" ? option.key.trim() : "";
if (!key) throw new Error("Every poll option needs a key.");
if (seen.has(key)) throw new Error(`Duplicate poll option key "${key}".`);
seen.add(key);
}
const tiers = (data?.weightTiers ?? []) as { multiplier?: unknown }[];
for (const tier of tiers) {
const multiplier = tier.multiplier;
if (typeof multiplier !== "number" || !Number.isFinite(multiplier) || multiplier <= 0) {
throw new Error("Every voting weight tier needs a positive multiplier.");
}
}
return data;
},
],
},
fields: [
{
name: "title",
type: "text",
required: true,
admin: { description: "The question, as it appears on both surfaces." },
},
{
name: "body",
type: "textarea",
admin: {
description:
"Optional context under the question. Plain text with **bold** and line breaks; both surfaces render it the same way.",
},
},
{
name: "options",
type: "array",
required: true,
minRows: 2,
maxRows: 10,
admin: { description: "The answers on offer. Keys are stable and never shown." },
fields: [
{
name: "key",
type: "text",
required: true,
admin: { description: "Stable slug, e.g. 'accept'. Votes reference this, never the row." },
},
{ name: "label", type: "text", required: true },
{
name: "emoji",
type: "text",
admin: { description: "Optional emoji shown before the label on both surfaces." },
},
{ name: "description", type: "text" },
],
},
{
name: "status",
type: "select",
required: true,
defaultValue: "open",
options: [
{ label: "Open", value: "open" },
{ label: "Tied (awaiting a superuser)", value: "pending_decision" },
{ label: "Closed", value: "closed" },
],
admin: { readOnly: true },
},
{
name: "closesAt",
type: "date",
required: true,
admin: {
date: { pickerAppearance: "dayAndTime" },
description: "When voting stops. Voting is also refused past this moment by the service.",
},
},
{
name: "multiSelect",
type: "checkbox",
defaultValue: false,
admin: { description: "Allow more than one answer per voter." },
},
{
name: "anonymity",
type: "select",
required: true,
defaultValue: "public",
options: [
{ label: "Public (everyone sees who voted)", value: "public" },
{ label: "Anonymous (counts for members, names for superusers)", value: "anonymous" },
],
admin: {
description:
"Anonymous hides voter identities from everyone except superusers. Counts are always visible.",
},
},
{
name: "eligibleRoles",
type: "relationship",
relationTo: "roles",
hasMany: true,
admin: {
description:
"Leave empty for the whole unit. When set, only holders of these roles may vote.",
},
},
{
name: "defaultWeight",
type: "number",
defaultValue: 1,
min: 0.1,
admin: {
description:
"Voting weight for everyone without a matching tier. Tiers pick the HIGHEST matching multiplier, never a sum.",
},
},
{
name: "weightTiers",
type: "array",
label: "Voting weight tiers",
admin: {
description:
"Optional role-based weight, e.g. Logistics 1.5. Resolved at close, from the roles each voter holds then.",
},
fields: [
{ name: "label", type: "text", required: true },
{
name: "roles",
type: "relationship",
relationTo: "roles",
hasMany: true,
required: true,
},
{
name: "multiplier",
type: "number",
required: true,
min: 0.1,
admin: { description: "1.5 means this role's vote counts 50% more." },
},
],
},
{
name: "resultFlag",
type: "text",
admin: {
description:
"Optional global player-flag key written with the winning option's key when the poll resolves. Must already exist in Player Flags.",
},
},
{
name: "tieGraceHours",
type: "number",
defaultValue: 24,
min: 1,
admin: {
description:
"How long a superuser has to break a tie before a random tied option is chosen.",
},
},
// Provenance. Written once, at launch.
{
name: "sourceKey",
type: "text",
required: true,
unique: true,
admin: {
readOnly: true,
description: "`<dialogueId>:<nodeId>`. Makes the dialogue trigger idempotent.",
},
},
{
name: "dialogue",
type: "relationship",
relationTo: "npc-dialogues",
admin: { readOnly: true },
},
{
name: "nodeId",
type: "text",
admin: { readOnly: true },
},
{
name: "initiatedBy",
type: "relationship",
relationTo: "users",
admin: {
readOnly: true,
description:
"The player who reached the node first. Their vote is the first tie-breaker.",
},
},
{
name: "openedAt",
type: "date",
admin: { readOnly: true },
},
// Resolution.
{
name: "closedAt",
type: "date",
admin: { readOnly: true, description: "When voting stopped and the tally froze." },
},
{
name: "decisionDeadline",
type: "date",
admin: {
readOnly: true,
description: "A tied poll: when a random tied option wins if no superuser decides.",
},
},
{
name: "decidedBy",
type: "relationship",
relationTo: "users",
admin: { readOnly: true },
},
{
name: "resolvedAt",
type: "date",
admin: { readOnly: true },
},
{
name: "winnerKey",
type: "text",
admin: { readOnly: true },
},
{
name: "resolutionMethod",
type: "select",
options: [
{ label: "Most votes", value: "votes" },
{ label: "Initiator's vote", value: "initiator" },
{ label: "Superuser decision", value: "superuser" },
{ label: "Random (deadline)", value: "random" },
{ label: "No votes", value: "no_votes" },
],
admin: { readOnly: true },
},
{
name: "outcome",
type: "json",
admin: {
readOnly: true,
description:
"The tally frozen at close: per-option raw and weighted counts, top options, and the resolution.",
},
},
// Discord sync, mirroring the mission roll-call lifecycle.
{
name: "discordMessageId",
type: "text",
admin: { readOnly: true },
},
{
name: "discordChannelId",
type: "text",
admin: { readOnly: true },
},
{
name: "discordPostedAt",
type: "date",
admin: { readOnly: true },
},
{
name: "discordPollHash",
type: "text",
admin: {
readOnly: true,
description: "Content hash of the last message the bot rendered; drift triggers an edit.",
},
},
],
};

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,14 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TYPE "public"."enum_game_event_logs_target_collection" ADD VALUE 'polls';`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "game_event_logs" ALTER COLUMN "target_collection" SET DATA TYPE text;
DROP TYPE "public"."enum_game_event_logs_target_collection";
CREATE TYPE "public"."enum_game_event_logs_target_collection" AS ENUM('game-structures', 'game-vehicles', 'game-npcs', 'npc-staffing', 'structures', 'resources', 'assets', 'vehicles', 'factions', 'missions', 'campaigns', 'users', 'technologies', 'tech-researches', 'tech-ballots', 'maps', 'shipments', 'bank-accounts', 'bank-transactions', 'ledger-entries', 'locker-storages', 'loadouts', 'market-listings', 'market-negotiations', 'market-state', 'evaluations', 'tickets', 'wiki-pages', 'wiki-revisions', 'wiki-templates', 'form-submissions', 'mission-map-markers', 'map-objectives', 'contribution-entries', 'game-servers', 'assignment-transfers', 'voice-scripts', 'voice-submissions', 'story-beats', 'journals', 'awards', 'story-beat-states', 'custom-minefields', 'custom-minefield-scores', 'custom-radio-tests', 'custom-radio-test-scores', 'ribbon-submissions', 'promotion-nominations', 'leadership-transfers', 'player-flags', 'reinforcement-pools');
ALTER TABLE "game_event_logs" ALTER COLUMN "target_collection" SET DATA TYPE "public"."enum_game_event_logs_target_collection" USING "target_collection"::"public"."enum_game_event_logs_target_collection";`)
}

View file

@ -171,7 +171,9 @@ import * as migration_20261124_223724_add_conversation_typewriter_setting from '
import * as migration_20261124_225400_add_conversation_voice_preference from './20261124_225400_add_conversation_voice_preference'; import * as migration_20261124_225400_add_conversation_voice_preference from './20261124_225400_add_conversation_voice_preference';
import * as migration_20261124_232253_add_npc_dialogue_testing_flag from './20261124_232253_add_npc_dialogue_testing_flag'; import * as migration_20261124_232253_add_npc_dialogue_testing_flag from './20261124_232253_add_npc_dialogue_testing_flag';
import * as migration_20261125_000236_add_dialogue_typing_sound_preference from './20261125_000236_add_dialogue_typing_sound_preference'; import * as migration_20261125_000236_add_dialogue_typing_sound_preference from './20261125_000236_add_dialogue_typing_sound_preference';
import * as migration_20261201_175529_add_polls from './20261201_175529_add_polls';
import * as migration_20261201_180344_add_npc_dialogue_typing_pace from './20261201_180344_add_npc_dialogue_typing_pace'; import * as migration_20261201_180344_add_npc_dialogue_typing_pace from './20261201_180344_add_npc_dialogue_typing_pace';
import * as migration_20261201_183001_add_polls_event_target from './20261201_183001_add_polls_event_target';
export const migrations = [ export const migrations = [
{ {
@ -1039,9 +1041,19 @@ export const migrations = [
down: migration_20261125_000236_add_dialogue_typing_sound_preference.down, down: migration_20261125_000236_add_dialogue_typing_sound_preference.down,
name: '20261125_000236_add_dialogue_typing_sound_preference', name: '20261125_000236_add_dialogue_typing_sound_preference',
}, },
{
up: migration_20261201_175529_add_polls.up,
down: migration_20261201_175529_add_polls.down,
name: '20261201_175529_add_polls',
},
{ {
up: migration_20261201_180344_add_npc_dialogue_typing_pace.up, up: migration_20261201_180344_add_npc_dialogue_typing_pace.up,
down: migration_20261201_180344_add_npc_dialogue_typing_pace.down, down: migration_20261201_180344_add_npc_dialogue_typing_pace.down,
name: '20261201_180344_add_npc_dialogue_typing_pace' name: '20261201_180344_add_npc_dialogue_typing_pace',
},
{
up: migration_20261201_183001_add_polls_event_target.up,
down: migration_20261201_183001_add_polls_event_target.down,
name: '20261201_183001_add_polls_event_target'
}, },
]; ];

View file

@ -83,6 +83,8 @@ export interface Config {
'game-event-logs': GameEventLog; 'game-event-logs': GameEventLog;
'structure-rooms': StructureRoom; 'structure-rooms': StructureRoom;
'interior-jobs': InteriorJob; 'interior-jobs': InteriorJob;
polls: Poll;
'poll-votes': PollVote;
users: User; users: User;
roles: Role; roles: Role;
ranks: Rank; ranks: Rank;
@ -202,6 +204,8 @@ export interface Config {
'game-event-logs': GameEventLogsSelect<false> | GameEventLogsSelect<true>; 'game-event-logs': GameEventLogsSelect<false> | GameEventLogsSelect<true>;
'structure-rooms': StructureRoomsSelect<false> | StructureRoomsSelect<true>; 'structure-rooms': StructureRoomsSelect<false> | StructureRoomsSelect<true>;
'interior-jobs': InteriorJobsSelect<false> | InteriorJobsSelect<true>; 'interior-jobs': InteriorJobsSelect<false> | InteriorJobsSelect<true>;
polls: PollsSelect<false> | PollsSelect<true>;
'poll-votes': PollVotesSelect<false> | PollVotesSelect<true>;
users: UsersSelect<false> | UsersSelect<true>; users: UsersSelect<false> | UsersSelect<true>;
roles: RolesSelect<false> | RolesSelect<true>; roles: RolesSelect<false> | RolesSelect<true>;
ranks: RanksSelect<false> | RanksSelect<true>; ranks: RanksSelect<false> | RanksSelect<true>;
@ -1024,6 +1028,11 @@ export interface Role {
| 'form-submissions:delete' | 'form-submissions:delete'
| 'admin:forms:manage' | 'admin:forms:manage'
| 'admin:form-submissions:manage' | 'admin:form-submissions:manage'
| 'polls:create'
| 'polls:read'
| 'polls:update'
| 'polls:delete'
| 'admin:polls:manage'
| 'contribution-entries:read' | 'contribution-entries:read'
| 'contribution-entries:create' | 'contribution-entries:create'
| 'contribution-entries:update' | 'contribution-entries:update'
@ -3602,6 +3611,11 @@ export interface GameEventLog {
| 'form-submissions:delete' | 'form-submissions:delete'
| 'admin:forms:manage' | 'admin:forms:manage'
| 'admin:form-submissions:manage' | 'admin:form-submissions:manage'
| 'polls:create'
| 'polls:read'
| 'polls:update'
| 'polls:delete'
| 'admin:polls:manage'
| 'contribution-entries:read' | 'contribution-entries:read'
| 'contribution-entries:create' | 'contribution-entries:create'
| 'contribution-entries:update' | 'contribution-entries:update'
@ -3714,6 +3728,7 @@ export interface GameEventLog {
| 'leadership-transfers' | 'leadership-transfers'
| 'player-flags' | 'player-flags'
| 'reinforcement-pools' | 'reinforcement-pools'
| 'polls'
) )
| null; | null;
targetId?: number | null; targetId?: number | null;
@ -3856,6 +3871,146 @@ export interface InteriorJob {
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }
/**
* Unit-wide polls raised by NPC conversations. Read-only here: they are created by the dialogue effect and resolved by the poll service.
*
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "polls".
*/
export interface Poll {
id: number;
/**
* The question, as it appears on both surfaces.
*/
title: string;
/**
* Optional context under the question. Plain text with **bold** and line breaks; both surfaces render it the same way.
*/
body?: string | null;
/**
* The answers on offer. Keys are stable and never shown.
*/
options: {
/**
* Stable slug, e.g. 'accept'. Votes reference this, never the row.
*/
key: string;
label: string;
/**
* Optional emoji shown before the label on both surfaces.
*/
emoji?: string | null;
description?: string | null;
id?: string | null;
}[];
status: 'open' | 'pending_decision' | 'closed';
/**
* When voting stops. Voting is also refused past this moment by the service.
*/
closesAt: string;
/**
* Allow more than one answer per voter.
*/
multiSelect?: boolean | null;
/**
* Anonymous hides voter identities from everyone except superusers. Counts are always visible.
*/
anonymity: 'public' | 'anonymous';
/**
* Leave empty for the whole unit. When set, only holders of these roles may vote.
*/
eligibleRoles?: (number | Role)[] | null;
/**
* Voting weight for everyone without a matching tier. Tiers pick the HIGHEST matching multiplier, never a sum.
*/
defaultWeight?: number | null;
/**
* Optional role-based weight, e.g. Logistics 1.5. Resolved at close, from the roles each voter holds then.
*/
weightTiers?:
| {
label: string;
roles: (number | Role)[];
/**
* 1.5 means this role's vote counts 50% more.
*/
multiplier: number;
id?: string | null;
}[]
| null;
/**
* Optional global player-flag key written with the winning option's key when the poll resolves. Must already exist in Player Flags.
*/
resultFlag?: string | null;
/**
* How long a superuser has to break a tie before a random tied option is chosen.
*/
tieGraceHours?: number | null;
/**
* `<dialogueId>:<nodeId>`. Makes the dialogue trigger idempotent.
*/
sourceKey: string;
dialogue?: (number | null) | NpcDialogue;
nodeId?: string | null;
/**
* The player who reached the node first. Their vote is the first tie-breaker.
*/
initiatedBy?: (number | null) | User;
openedAt?: string | null;
/**
* When voting stopped and the tally froze.
*/
closedAt?: string | null;
/**
* A tied poll: when a random tied option wins if no superuser decides.
*/
decisionDeadline?: string | null;
decidedBy?: (number | null) | User;
resolvedAt?: string | null;
winnerKey?: string | null;
resolutionMethod?: ('votes' | 'initiator' | 'superuser' | 'random' | 'no_votes') | null;
/**
* The tally frozen at close: per-option raw and weighted counts, top options, and the resolution.
*/
outcome?:
| {
[k: string]: unknown;
}
| unknown[]
| string
| number
| boolean
| null;
discordMessageId?: string | null;
discordChannelId?: string | null;
discordPostedAt?: string | null;
/**
* Content hash of the last message the bot rendered; drift triggers an edit.
*/
discordPollHash?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* Ballots. Readable only by the superuser tier, which is what keeps anonymous polls anonymous for everyone else.
*
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "poll-votes".
*/
export interface PollVote {
id: number;
poll: number | Poll;
user: number | User;
/**
* The option keys this voter chose. One row on a single-answer poll; the service dedupes and rejects keys the poll does not carry.
*/
answers: {
key: string;
id?: string | null;
}[];
updatedAt: string;
createdAt: string;
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "ranks". * via the `definition` "ranks".
@ -7934,6 +8089,42 @@ export interface PayloadMcpApiKey {
*/ */
delete?: boolean | null; delete?: boolean | null;
}; };
polls?: {
/**
* Allow clients to find polls.
*/
find?: boolean | null;
/**
* Allow clients to create polls.
*/
create?: boolean | null;
/**
* Allow clients to update polls.
*/
update?: boolean | null;
/**
* Allow clients to delete polls.
*/
delete?: boolean | null;
};
pollVotes?: {
/**
* Allow clients to find poll-votes.
*/
find?: boolean | null;
/**
* Allow clients to create poll-votes.
*/
create?: boolean | null;
/**
* Allow clients to update poll-votes.
*/
update?: boolean | null;
/**
* Allow clients to delete poll-votes.
*/
delete?: boolean | null;
};
users?: { users?: {
/** /**
* Allow clients to find users. * Allow clients to find users.
@ -9573,6 +9764,14 @@ export interface PayloadLockedDocument {
relationTo: 'interior-jobs'; relationTo: 'interior-jobs';
value: number | InteriorJob; value: number | InteriorJob;
} | null) } | null)
| ({
relationTo: 'polls';
value: number | Poll;
} | null)
| ({
relationTo: 'poll-votes';
value: number | PollVote;
} | null)
| ({ | ({
relationTo: 'users'; relationTo: 'users';
value: number | User; value: number | User;
@ -10467,6 +10666,73 @@ export interface InteriorJobsSelect<T extends boolean = true> {
updatedAt?: T; updatedAt?: T;
createdAt?: T; createdAt?: T;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "polls_select".
*/
export interface PollsSelect<T extends boolean = true> {
title?: T;
body?: T;
options?:
| T
| {
key?: T;
label?: T;
emoji?: T;
description?: T;
id?: T;
};
status?: T;
closesAt?: T;
multiSelect?: T;
anonymity?: T;
eligibleRoles?: T;
defaultWeight?: T;
weightTiers?:
| T
| {
label?: T;
roles?: T;
multiplier?: T;
id?: T;
};
resultFlag?: T;
tieGraceHours?: T;
sourceKey?: T;
dialogue?: T;
nodeId?: T;
initiatedBy?: T;
openedAt?: T;
closedAt?: T;
decisionDeadline?: T;
decidedBy?: T;
resolvedAt?: T;
winnerKey?: T;
resolutionMethod?: T;
outcome?: T;
discordMessageId?: T;
discordChannelId?: T;
discordPostedAt?: T;
discordPollHash?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "poll-votes_select".
*/
export interface PollVotesSelect<T extends boolean = true> {
poll?: T;
user?: T;
answers?:
| T
| {
key?: T;
id?: T;
};
updatedAt?: T;
createdAt?: T;
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users_select". * via the `definition` "users_select".
@ -13242,6 +13508,22 @@ export interface PayloadMcpApiKeysSelect<T extends boolean = true> {
update?: T; update?: T;
delete?: T; delete?: T;
}; };
polls?:
| T
| {
find?: T;
create?: T;
update?: T;
delete?: T;
};
pollVotes?:
| T
| {
find?: T;
create?: T;
update?: T;
delete?: T;
};
users?: users?:
| T | T
| { | {
@ -14307,6 +14589,10 @@ export interface NpcDialogueSetting {
* The default for everyone. Players can override it in their account preferences, and a player whose device asks for reduced motion never sees the animation. * The default for everyone. Players can override it in their account preferences, and a player whose device asks for reduced motion never sees the animation.
*/ */
typewriterDefault?: boolean | null; typewriterDefault?: boolean | null;
/**
* How fast conversation lines type out and how long the pauses at punctuation last. Applies to the next conversation opened, with no deploy. Authors can still hold a specific line with {1.2s} or {400ms}.
*/
pacing?: ('subtle' | 'natural' | 'pronounced') | null;
}; };
/** /**
* Incremented automatically when the voice or house rules change. Recorded on each stored draft so you can tell which prompt produced it. * Incremented automatically when the voice or house rules change. Recorded on each stored draft so you can tell which prompt produced it.
@ -14476,6 +14762,7 @@ export interface NpcDialogueSettingsSelect<T extends boolean = true> {
| T | T
| { | {
typewriterDefault?: T; typewriterDefault?: T;
pacing?: T;
}; };
revision?: T; revision?: T;
updatedAt?: T; updatedAt?: T;

View file

@ -100,6 +100,8 @@ import { StoryBeats } from "@/collections/story/StoryBeats";
import { Journals } from "@/collections/story/Journals"; import { Journals } from "@/collections/story/Journals";
import { StoryBeatStates } from "@/collections/story/StoryBeatStates"; import { StoryBeatStates } from "@/collections/story/StoryBeatStates";
import { Voiceovers } from "@/collections/story/Voiceovers"; import { Voiceovers } from "@/collections/story/Voiceovers";
import { Polls } from "@/collections/polls/Polls";
import { PollVotes } from "@/collections/polls/PollVotes";
import { Shims } from "@/collections/Shims"; import { Shims } from "@/collections/Shims";
import { Announcements } from "@/collections/Announcements"; import { Announcements } from "@/collections/Announcements";
import { CustomMinefields } from "@/collections/minigames/CustomMinefields"; import { CustomMinefields } from "@/collections/minigames/CustomMinefields";
@ -255,6 +257,10 @@ const collections = [
StructureRooms, StructureRooms,
InteriorJobs, InteriorJobs,
// Polls
Polls,
PollVotes,
// Users // Users
Users, Users,
Roles, Roles,

View file

@ -790,6 +790,16 @@ export const PERMISSION_GROUPS: PermissionGroup[] = [
{ value: "admin:form-submissions:manage", label: "Manage Submissions Admin Page" }, { value: "admin:form-submissions:manage", label: "Manage Submissions Admin Page" },
], ],
}, },
{
group: "Polls",
permissions: [
{ value: "polls:create", label: "Create" },
{ value: "polls:read", label: "Read" },
{ value: "polls:update", label: "Update (close a poll early)" },
{ value: "polls:delete", label: "Delete" },
{ value: "admin:polls:manage", label: "Manage Admin Page" },
],
},
{ {
group: "Contributions", group: "Contributions",
permissions: [ permissions: [
@ -1281,6 +1291,11 @@ export const ALL_PERMISSION_VALUES = PERMISSION_GROUPS.flatMap((g) =>
"form-submissions:delete", "form-submissions:delete",
"admin:forms:manage", "admin:forms:manage",
"admin:form-submissions:manage", "admin:form-submissions:manage",
"polls:create",
"polls:read",
"polls:update",
"polls:delete",
"admin:polls:manage",
"contribution-entries:read", "contribution-entries:read",
"contribution-entries:create", "contribution-entries:create",
"contribution-entries:update", "contribution-entries:update",