forked from yvv/decision
Fusion de la tête du chantier (924a40d : lots B2 et F) dans le lot D
Les deux côtés gardés partout. Aux coutures : - une objection (redit / contredit) porte sur deux articles, jamais sur un module ; un ordre ne se corrige pas, ni par son auteur ni par un autre ; une coquille du titre suit le chemin de F (l'auteur du titre, un administrateur pour le titre de départ, ou 3 jours), et documents.title suit à l'application ; - votable() couvre les modules ; leurs totaux passent par shown_tally, à l'écran et dans document.json ; - « Modules à voter » ne compte plus une version retenue par une objection (test vu rouge) ; la liste du groupe la compte toujours parmi les propositions en cours ; - le panier : une fonction pour les articles et les modules, avec les versions retenues de F ; un nouvel article se propose dans une section, à sa fin, et peut répondre à une objection ; - migrations 0007 (modules) puis 0008 (objections) ; - C25 et C26 supportent un groupe d'essai où une voix suffit (dès 16 membres). Boucle : fmt, clippy -D warnings, cargo test (227), svelte-check 0, vitest 55, build, e2e 35 / 35 (C1–C33 et M1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+15
-4
@@ -17,6 +17,8 @@ export interface Slot {
|
||||
versions: Proposal[];
|
||||
/** Open changes of its inertia: another question, never filled by a grouped gesture. */
|
||||
inertia: Proposal[];
|
||||
/** Versions held back by an objection: shown, not votable until it is lifted (ADR 0010). */
|
||||
held: Proposal[];
|
||||
}
|
||||
|
||||
export interface Section {
|
||||
@@ -25,15 +27,19 @@ export interface Section {
|
||||
slots: Slot[];
|
||||
}
|
||||
|
||||
/** What a unit offers to vote: its version in force and open versions, its open changes of inertia. */
|
||||
/**
|
||||
* What a unit offers to vote: its version in force and open versions, its open changes
|
||||
* of inertia — and, apart, its versions held back by an objection (ADR 0010).
|
||||
*/
|
||||
function slotOf(unit: Unit): Slot | null {
|
||||
const open = unit.proposals.filter((p) => p.status === 'open');
|
||||
const versions = [
|
||||
...(unit.inForce?.status === 'in_force' ? [unit.inForce] : []),
|
||||
...open.filter((p) => p.kind !== 'inertia'),
|
||||
...open.filter((p) => p.kind !== 'inertia' && p.votable !== false),
|
||||
];
|
||||
const inertia = open.filter((p) => p.kind === 'inertia');
|
||||
return versions.length || inertia.length ? { unit, versions, inertia } : null;
|
||||
const held = open.filter((p) => p.kind !== 'inertia' && p.votable === false);
|
||||
return versions.length || inertia.length || held.length ? { unit, versions, inertia, held } : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,9 +83,14 @@ export function waiting(slots: Slot[], picks: Picks): Slot[] {
|
||||
return slots.filter((s) => s.versions.length > 1 && !s.versions.some((p) => p.id in picks));
|
||||
}
|
||||
|
||||
/** The versions one may vote now: those a choice of the basket is sent for. */
|
||||
export function votableIds(all: Section[]): Set<string> {
|
||||
return new Set(all.flatMap((s) => s.slots.flatMap((x) => [...x.versions, ...x.inertia].map((p) => p.id))));
|
||||
}
|
||||
|
||||
/** Empties the basket of these articles only. */
|
||||
export function clearScope(slots: Slot[], picks: Picks): Picks {
|
||||
const ids = new Set(slots.flatMap((s) => [...s.versions, ...s.inertia].map((p) => p.id)));
|
||||
const ids = new Set(slots.flatMap((s) => [...s.versions, ...s.inertia, ...s.held].map((p) => p.id)));
|
||||
return Object.fromEntries(Object.entries(picks).filter(([id]) => !ids.has(id)));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
// section entière, ou un article avec son titre, ou séparément »): choices
|
||||
// article by article, « tout pour » / « tout contre » for a section or the whole
|
||||
// document — never for an article whose versions compete —, then one gesture.
|
||||
// A version held back by an objection is shown, with nothing to choose.
|
||||
import { onMount } from 'svelte';
|
||||
import { clearScope, counts, fill, lines, sections, waiting, type Section, type Slot } from '$lib/basket';
|
||||
import { clearScope, counts, fill, lines, sections, votableIds, waiting, type Section, type Slot } from '$lib/basket';
|
||||
import type { DocState } from '$lib/doc.svelte';
|
||||
import { i18n, t } from '$lib/i18n/index.svelte';
|
||||
import { moduleName, relationOf, sectionLabel, titleOf } from '$lib/labels';
|
||||
@@ -35,7 +36,7 @@
|
||||
// The modules too (ADR 0009): the title first, each order at the end of its section.
|
||||
const all = $derived(sections(view?.units ?? [], view?.modules));
|
||||
const slots = $derived(all.flatMap((s) => s.slots));
|
||||
const known = $derived(new Set(slots.flatMap((s) => [...s.versions, ...s.inertia].map((p) => p.id))));
|
||||
const known = $derived(votableIds(all));
|
||||
const toSend = $derived(lines(basket.picks, known));
|
||||
const tally = $derived(counts(Object.fromEntries(Object.entries(basket.picks).filter(([id]) => known.has(id)))));
|
||||
const left = $derived(waiting(slots, basket.picks));
|
||||
@@ -50,7 +51,7 @@
|
||||
|
||||
function headline(s: Slot): string {
|
||||
if (s.unit.kind) return moduleName(s.unit);
|
||||
const text = s.versions.find((p) => p.kind === 'text');
|
||||
const text = [...s.versions, ...s.held].find((p) => p.kind === 'text');
|
||||
return text?.title ?? (s.versions[0] ? titleOf(s.versions[0], s.unit) : s.unit.code);
|
||||
}
|
||||
|
||||
@@ -125,7 +126,7 @@
|
||||
{#each s.slots as slot (slot.unit.id)}
|
||||
{@const title = headline(slot)}
|
||||
{@const several = slot.versions.length > 1}
|
||||
{@const first = slot.versions[0] ?? slot.inertia[0]}
|
||||
{@const first = slot.versions[0] ?? slot.inertia[0] ?? slot.held[0]}
|
||||
<li class="slot" class:several class:waiting={left.includes(slot)}>
|
||||
<button class="title" type="button" onclick={() => first && onread(first.id)}>{title}</button>
|
||||
{#if several}<p class="versions-note">{t('basket.versions')}</p>{/if}
|
||||
@@ -147,6 +148,15 @@
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
{#each slot.held as v (v.id)}
|
||||
<div class="version held">
|
||||
<span class="about">
|
||||
<span class="label">{labelOf(v, slot)}</span>
|
||||
<span class="faint small">{t('tally.short', { for: v.tally.for, against: v.tally.against })}</span>
|
||||
</span>
|
||||
<span class="held-note">{t('basket.held')}</span>
|
||||
</div>
|
||||
{/each}
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
@@ -161,9 +171,11 @@
|
||||
<button class="btn primary" type="button" disabled={!open || !toSend.length || busy} onclick={send}>
|
||||
{access?.way === 'chain' ? t('basket.send.chain', { n: toSend.length }) : t('basket.send.server', { n: toSend.length })}
|
||||
</button>
|
||||
<p class="faint small note-send">
|
||||
{#if access?.way === 'chain' && access.chain}{t('basket.note.chain', { amount: g1Amount(access.chain.amount) })}{:else}{t('basket.note.server')}{/if}
|
||||
</p>
|
||||
{#if open}
|
||||
<p class="faint small note-send">
|
||||
{#if access?.way === 'chain' && access.chain}{t('basket.note.chain', { amount: g1Amount(access.chain.amount) })}{:else}{t('basket.note.server')}{/if}
|
||||
</p>
|
||||
{/if}
|
||||
{#if error}<p class="warn" role="alert">{error}</p>{/if}
|
||||
</footer>
|
||||
</section>
|
||||
@@ -281,6 +293,17 @@
|
||||
.small {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.version.held .label {
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
.held-note {
|
||||
padding: 0.25rem 0.7rem;
|
||||
border-radius: var(--r-pill);
|
||||
background: var(--ochre-wash);
|
||||
color: var(--ochre);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 750;
|
||||
}
|
||||
.send {
|
||||
position: sticky;
|
||||
bottom: -1.6rem;
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
// the ballot, the person's wallet signs one transaction — the amount to the
|
||||
// vote account and the seal of the ballot —, the page waits for the chain to
|
||||
// show it. Without a wallet in the browser: Ğecko, with a link and a QR code.
|
||||
//
|
||||
// A ballot nothing left for is let go at once (`DELETE`): the wallet refused,
|
||||
// the node did not answer before signing, the window was closed before it.
|
||||
// Once signed, the transaction may land: the ballot is kept, and so is a
|
||||
// Ğecko code — the server reads the indexer for them, the page open or not.
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { api } from '$lib/api';
|
||||
import type { DocState } from '$lib/doc.svelte';
|
||||
@@ -10,7 +15,7 @@
|
||||
import type { Ballot, ChainSettings } from '$lib/types';
|
||||
import { announce, errorText, g1Amount, type Line } from '$lib/vote';
|
||||
import { geckoLink, qrPath } from '$lib/wallet/gecko';
|
||||
import { failure, nothingSent, wallets, type Failure, type Wallet, type WalletAccount } from '$lib/wallet/injected';
|
||||
import { failure, mayLetGo, wallets, type Failure, type Wallet, type WalletAccount } from '$lib/wallet/injected';
|
||||
|
||||
let {
|
||||
doc,
|
||||
@@ -47,11 +52,19 @@
|
||||
let ballot = $state<Ballot | null>(null);
|
||||
let timer: ReturnType<typeof setInterval> | undefined;
|
||||
let closed = false;
|
||||
/** The transaction of the current ballot is signed: it may reach the chain. */
|
||||
let left = false;
|
||||
/** A wallet is asked to sign: its own window may stay open after this one closes. */
|
||||
let asking = false;
|
||||
/** The current ballot was let go: nothing left for it. */
|
||||
let dropped = false;
|
||||
|
||||
const amount = $derived(g1Amount(chain.amount));
|
||||
const short = (a: string) => `${a.slice(0, 6)}…${a.slice(-4)}`;
|
||||
/** Ğecko is offered where nothing is being signed nor waited for. */
|
||||
const geckoOffered = $derived(['none', 'wallets', 'accounts', 'failed', 'expired', 'refused'].includes(step.kind));
|
||||
/** The receipt of a ballot that left, or may still. */
|
||||
const receiptShown = $derived(['waiting', 'gecko', 'confirmed', 'refused'].includes(step.kind));
|
||||
|
||||
onMount(() => {
|
||||
dialog?.showModal();
|
||||
@@ -64,9 +77,19 @@
|
||||
timer = undefined;
|
||||
}
|
||||
|
||||
/** Nothing left for this ballot: it is let go, rather than shown as waiting for a day. */
|
||||
async function letGo(b: Ballot) {
|
||||
if (dropped || ballot?.id !== b.id) return;
|
||||
dropped = true;
|
||||
await api.del(`/ballots/${b.id}`).catch(() => undefined);
|
||||
}
|
||||
|
||||
function close() {
|
||||
closed = true;
|
||||
stop();
|
||||
// Closed before anything left (and no Ğecko code shown): let it go. A wallet still
|
||||
// asking keeps it until it answers — signed, it may land; refused, `go` lets it go.
|
||||
if (ballot?.status === 'pending' && !left && !asking && step.kind !== 'gecko') void letGo(ballot);
|
||||
dialog?.close();
|
||||
onclose();
|
||||
}
|
||||
@@ -113,6 +136,7 @@
|
||||
step = { kind: 'failed', text: t(`sign.error.${failure(e)}`) };
|
||||
return;
|
||||
}
|
||||
if (closed) return;
|
||||
const usual = accounts.find((a) => a.address === address);
|
||||
if (usual) return go(wallet, usual);
|
||||
const [only] = accounts;
|
||||
@@ -134,38 +158,42 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** Signed: from now on the transaction may reach the chain. */
|
||||
function onTheWay(b: Ballot) {
|
||||
if (left) return;
|
||||
left = true;
|
||||
onsent();
|
||||
if (!closed) wait(b);
|
||||
}
|
||||
|
||||
async function go(wallet: Wallet, account: WalletAccount) {
|
||||
remember(wallet, account);
|
||||
step = { kind: 'opening' };
|
||||
const b = await seal(account.address);
|
||||
if (!b) return;
|
||||
ballot = b;
|
||||
let sent = false;
|
||||
left = false;
|
||||
dropped = false;
|
||||
if (closed) return letGo(b);
|
||||
asking = true;
|
||||
try {
|
||||
step = { kind: 'signing' };
|
||||
await wallet.send(account, { dest: b.account, amount: BigInt(b.amount), remark: b.comment }, (s) => {
|
||||
if (s === 'signing') step = { kind: 'signing' };
|
||||
else if (!sent) {
|
||||
sent = true;
|
||||
onsent();
|
||||
wait(b);
|
||||
}
|
||||
if (s === 'signing') {
|
||||
if (!closed) step = { kind: 'signing' };
|
||||
} else onTheWay(b);
|
||||
});
|
||||
if (!sent) {
|
||||
sent = true;
|
||||
onsent();
|
||||
wait(b);
|
||||
}
|
||||
onTheWay(b);
|
||||
} catch (e) {
|
||||
const f: Failure = failure(e);
|
||||
// Once on its way, the chain may still take it: keep waiting.
|
||||
if (sent && f === 'node') return;
|
||||
if (nothingSent(f)) {
|
||||
if (f === 'account') remember(null);
|
||||
await api.del(`/ballots/${b.id}`).catch(() => undefined);
|
||||
}
|
||||
// Signed, then the node or the wallet went quiet: it may still land. Keep waiting.
|
||||
if (!mayLetGo(f, left)) return;
|
||||
if (f === 'account') remember(null);
|
||||
await letGo(b);
|
||||
stop();
|
||||
step = { kind: 'failed', text: t(`sign.error.${f}`) };
|
||||
if (!closed) step = { kind: 'failed', text: t(`sign.error.${f}`) };
|
||||
} finally {
|
||||
asking = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,6 +202,9 @@
|
||||
const b = await seal(null);
|
||||
if (!b) return;
|
||||
ballot = b;
|
||||
left = false;
|
||||
dropped = false;
|
||||
if (closed) return letGo(b);
|
||||
const link = geckoLink(b.account, b.amount, b.comment);
|
||||
step = { kind: 'gecko', link, qr: await qrPath(link) };
|
||||
wait(b);
|
||||
@@ -271,6 +302,13 @@
|
||||
{:else if step.kind === 'failed'}
|
||||
<p class="warn" role="alert">{step.text}</p>
|
||||
{/if}
|
||||
{#if receiptShown && ballot}
|
||||
<p class="receipt small">
|
||||
<a href="/api/ballots/{ballot.id}/receipt" download>{t('sign.receipt')}</a>
|
||||
· <a href="/bulletins">{t('sign.history')}</a>
|
||||
</p>
|
||||
<p class="faint small">{t('sign.receipt.note')}</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
@@ -393,6 +431,10 @@
|
||||
.small {
|
||||
font-size: 0.84rem;
|
||||
}
|
||||
.receipt a {
|
||||
font-weight: 750;
|
||||
color: var(--water);
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
{#snippet marks(p: Proposal)}
|
||||
{#if p.evaluation?.wellRated}<span class="tag water">{t('deep.wellrated')}</span>{/if}
|
||||
{#if p.blocked}<span class="tag ochre">{t('deep.blocked')}</span>{/if}
|
||||
{#if p.blocked}<span class="tag ochre">{t('deep.held')}</span>{/if}
|
||||
{#if p.myVoteStale}<span class="tag ochre">{t('deep.stale')}</span>{/if}
|
||||
{#if p.mine}<span class="tag">{t('deep.mine')}</span>{/if}
|
||||
{/snippet}
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
import type { DocState, PanelState } from '$lib/doc.svelte';
|
||||
import { t } from '$lib/i18n/index.svelte';
|
||||
import { relationOf, titleOf } from '$lib/labels';
|
||||
import { answerPanel } from '$lib/objections';
|
||||
import type { BasketState } from '$lib/picks.svelte';
|
||||
import { session } from '$lib/session.svelte';
|
||||
import type { Lang, Proposal } from '$lib/types';
|
||||
import type { Line } from '$lib/vote';
|
||||
import BallotPanel from './BallotPanel.svelte';
|
||||
@@ -84,7 +86,7 @@
|
||||
<div class="bar">
|
||||
<div class="tabs" role="tablist" bind:this={tablist}>
|
||||
{#each tabs as [key, label] (key)}
|
||||
<button role="tab" type="button" aria-selected={panel.tab === key} class:on={panel.tab === key} onclick={() => onchange({ ...panel, tab: key, prefill: null })}>{label}</button>
|
||||
<button role="tab" type="button" aria-selected={panel.tab === key} class:on={panel.tab === key} onclick={() => onchange({ ...panel, tab: key, prefill: null, objectionId: null, edit: false })}>{label}</button>
|
||||
{/each}
|
||||
</div>
|
||||
<button class="close" type="button" onclick={onclose} aria-label={t('panel.close')}><Icon name="close" /></button>
|
||||
@@ -98,8 +100,13 @@
|
||||
{doc}
|
||||
proposalId={voteId}
|
||||
{lang}
|
||||
edit={!!panel.edit}
|
||||
onvote={(id) => onvote(id, true)}
|
||||
onpropose={(prefill) => onchange({ ...panel, tab: 'propose', prefill, draftId: null })}
|
||||
onpropose={(prefill) => onchange({ ...panel, tab: 'propose', prefill, draftId: null, edit: false })}
|
||||
onanswer={(o) => {
|
||||
const next = answerPanel(o, session.me?.id ?? null);
|
||||
if (next) onchange(next);
|
||||
}}
|
||||
/>
|
||||
{:else if panel.tab === 'proposals' && unit}
|
||||
<ul class="versions">
|
||||
@@ -110,7 +117,7 @@
|
||||
<span class="text">
|
||||
<span class="eyebrow">{v.status === 'in_force' ? t('panel.inforce') : t('panel.proposal')}</span>
|
||||
<span class="title">{nameOfVersion(v)}</span>
|
||||
<span class="faint small">{v.status === 'in_force' ? (v.seedMinimal ? t('doc.seed') : '') : relationOf(v, unit)} · {t('tally.short', { for: v.tally.for, against: v.tally.against })}{#if v.myVote && !v.myVoteStale} · {t('basket.mine', { choice: t(`vote.choice.${v.myVote}`) })}{/if}</span>
|
||||
<span class="faint small">{v.status === 'in_force' ? (v.seedMinimal ? t('doc.seed') : '') : relationOf(v, unit)} · {t('tally.short', { for: v.tally.for, against: v.tally.against })}{#if v.myVote && !v.myVoteStale} · {t('basket.mine', { choice: t(`vote.choice.${v.myVote}`) })}{/if}{#if v.blocked} · <b class="held">{t('deep.held')}</b>{/if}</span>
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
@@ -127,6 +134,8 @@
|
||||
unitId={panel.unitId}
|
||||
draftId={panel.draftId ?? null}
|
||||
prefill={panel.prefill ?? null}
|
||||
from={panel.objectionId ? (panel.proposalId ?? null) : null}
|
||||
objectionId={panel.objectionId ?? null}
|
||||
ondone={(r) =>
|
||||
r.proposalId && r.submitted
|
||||
? onvote(r.proposalId, true)
|
||||
@@ -234,6 +243,9 @@
|
||||
.small {
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
.held {
|
||||
color: var(--ochre);
|
||||
}
|
||||
@keyframes enter {
|
||||
from {
|
||||
transform: translateX(16px);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
// A few line icons, drawn here rather than pulled from a library.
|
||||
let { name, size = 18 }: { name: 'lock' | 'close' | 'menu' | 'moon' | 'sun' | 'chevron' | 'message' | 'key' | 'plus'; size?: number } = $props();
|
||||
let { name, size = 18 }: { name: 'lock' | 'close' | 'menu' | 'moon' | 'sun' | 'chevron' | 'message' | 'key' | 'plus' | 'inbox'; size?: number } = $props();
|
||||
</script>
|
||||
|
||||
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
@@ -22,5 +22,7 @@
|
||||
<circle cx="8" cy="15" r="4" /><path d="M11 12l8-8M16 7l2 2M14 9l2 2" />
|
||||
{:else if name === 'plus'}
|
||||
<path d="M12 5v14M5 12h14" />
|
||||
{:else if name === 'inbox'}
|
||||
<path d="M4 13l2.2-7.3A1 1 0 0 1 7.2 5h9.6a1 1 0 0 1 1 .7L20 13v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z" /><path d="M4 13h4.5l1 2h5l1-2H20" />
|
||||
{/if}
|
||||
</svg>
|
||||
|
||||
@@ -17,12 +17,18 @@
|
||||
unitId,
|
||||
draftId = null,
|
||||
prefill = null,
|
||||
from = null,
|
||||
objectionId = null,
|
||||
ondone,
|
||||
}: {
|
||||
doc: DocState;
|
||||
unitId: string | null;
|
||||
draftId?: string | null;
|
||||
prefill?: { title: string; body: string } | null;
|
||||
/** The version whose text the new one starts from (an answer to an objection). */
|
||||
from?: string | null;
|
||||
/** The objection this proposal answers (ADR 0010): linked to it when created. */
|
||||
objectionId?: string | null;
|
||||
ondone: (r: { proposalId: string | null; submitted: boolean }) => void;
|
||||
} = $props();
|
||||
|
||||
@@ -44,17 +50,19 @@
|
||||
// (Re)initialise only when the panel is pointed elsewhere — never on a reload,
|
||||
// which would wipe what the person is typing.
|
||||
$effect(() => {
|
||||
const [u0, d0, pf] = [unitId, draftId, prefill];
|
||||
const [u0, d0, pf, f0] = [unitId, draftId, prefill, from];
|
||||
void objectionId;
|
||||
untrack(() => {
|
||||
const u = doc.unit(u0);
|
||||
const d = doc.proposal(d0);
|
||||
const f = doc.proposal(f0);
|
||||
target = u0;
|
||||
savedId = d0;
|
||||
mode = u0 ? 'replace' : 'new';
|
||||
// The section of the article one comes from, else the last one.
|
||||
section = u?.section ?? doc.view?.units.at(-1)?.section ?? '';
|
||||
title = pf?.title ?? d?.title ?? u?.inForce?.title ?? u?.proposals[0]?.title ?? '';
|
||||
body = pf?.body ?? d?.body ?? u?.inForce?.body ?? '';
|
||||
title = pf?.title ?? d?.title ?? f?.title ?? u?.inForce?.title ?? u?.proposals[0]?.title ?? '';
|
||||
body = pf?.body ?? d?.body ?? f?.body ?? u?.inForce?.body ?? '';
|
||||
error = '';
|
||||
});
|
||||
});
|
||||
@@ -96,6 +104,7 @@
|
||||
title: mode === 'remove' ? (unit?.inForce?.title ?? title) : title,
|
||||
body: mode === 'remove' ? '' : body,
|
||||
submit: false,
|
||||
...(objectionId && mode !== 'new' ? { objectionId } : {}),
|
||||
});
|
||||
savedId = r.id;
|
||||
return r.id;
|
||||
@@ -155,6 +164,7 @@
|
||||
</script>
|
||||
|
||||
<div class="propose">
|
||||
{#if objectionId && mode !== 'new' && !draft}<p class="linked">{t('objection.linked')}</p>{/if}
|
||||
{#if !draft}
|
||||
<div class="modes" role="radiogroup" aria-label={t('panel.propose')}>
|
||||
{#if unit}
|
||||
@@ -252,6 +262,13 @@
|
||||
.assist .btn {
|
||||
justify-self: start;
|
||||
}
|
||||
.linked {
|
||||
padding: 0.7rem 0.9rem;
|
||||
border-radius: var(--r-input);
|
||||
background: var(--ochre-wash);
|
||||
font-weight: 650;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.small {
|
||||
font-size: 0.84rem;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,17 @@
|
||||
<a class="groups" href="/" class:current={path === '/'} aria-current={path === '/' ? 'page' : undefined} onclick={() => onnavigate?.()}>
|
||||
<span class="eyebrow">{t('nav.groups')}</span>
|
||||
</a>
|
||||
<a
|
||||
class="messages"
|
||||
href="/messages"
|
||||
class:current={path === '/messages'}
|
||||
aria-current={path === '/messages' ? 'page' : undefined}
|
||||
aria-label={session.unread ? i18n.plural('nav.messages.count', session.unread) : undefined}
|
||||
onclick={() => onnavigate?.()}
|
||||
>
|
||||
<Icon name="inbox" size={17} /><span>{t('nav.messages')}</span>
|
||||
{#if session.unread}<span class="unread" aria-hidden="true">{session.unread}</span>{/if}
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
<ul class="tools">
|
||||
@@ -146,6 +157,37 @@
|
||||
.groups.current .eyebrow {
|
||||
color: var(--ink);
|
||||
}
|
||||
.messages {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.55rem;
|
||||
min-height: 2.5rem;
|
||||
margin-top: -0.9rem;
|
||||
padding: 0.5rem 0.7rem;
|
||||
border-radius: var(--r-input);
|
||||
color: var(--ink);
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
transition: background-color 0.15s ease;
|
||||
}
|
||||
.messages:hover,
|
||||
.messages.current {
|
||||
background: var(--water-wash);
|
||||
}
|
||||
.messages.current {
|
||||
color: var(--water);
|
||||
}
|
||||
.unread {
|
||||
margin-left: auto;
|
||||
min-width: 1.6rem;
|
||||
padding: 0.05rem 0.45rem;
|
||||
border-radius: var(--r-pill);
|
||||
background: var(--ochre);
|
||||
color: var(--on-water);
|
||||
font-size: 0.78rem;
|
||||
font-weight: 800;
|
||||
text-align: center;
|
||||
}
|
||||
.tools {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
<script lang="ts">
|
||||
// A version in the panel, tab « Détails »: its text and what changed, then
|
||||
// what is not the vote — typos, translations, flags of contradiction, history.
|
||||
// The vote itself unfolds under the article (VoteFold).
|
||||
// what is not the vote — typos (and the fixes waiting for an answer),
|
||||
// translations, objections, history. The vote itself unfolds under the
|
||||
// article (VoteFold). Objections and validated typo fixes: ADR 0010.
|
||||
import { api, ApiError } from '$lib/api';
|
||||
import { condense } from '$lib/diff';
|
||||
import { shown, type DocState } from '$lib/doc.svelte';
|
||||
import { i18n, t, type Key } from '$lib/i18n/index.svelte';
|
||||
import { inertiaBadge, orderNote, titleOf } from '$lib/labels';
|
||||
import { session } from '$lib/session.svelte';
|
||||
import { toasts } from '$lib/toast.svelte';
|
||||
import { announce } from '$lib/vote';
|
||||
import type { DiffPart, Entered, Inertia, Lang, Proposal } from '$lib/types';
|
||||
import type { DiffPart, Entered, Inertia, Lang, Objection, ObjectionKind, Proposal, TypoFix } from '$lib/types';
|
||||
import DiffText from './DiffText.svelte';
|
||||
import Prose from './Prose.svelte';
|
||||
|
||||
@@ -16,27 +19,42 @@
|
||||
doc,
|
||||
proposalId,
|
||||
lang,
|
||||
edit = false,
|
||||
onvote,
|
||||
onpropose,
|
||||
onanswer,
|
||||
}: {
|
||||
doc: DocState;
|
||||
proposalId: string;
|
||||
lang: Lang;
|
||||
/** Opened to reword one's own version (an answer to an objection). */
|
||||
edit?: boolean;
|
||||
/** Unfolds the vote of this version under its article. */
|
||||
onvote: (proposalId: string) => void;
|
||||
onpropose: (prefill: { title: string; body: string }) => void;
|
||||
/** Answers an objection holding a version back: modify the article repeated, or reword. */
|
||||
onanswer: (objection: Objection) => void;
|
||||
} = $props();
|
||||
|
||||
interface HistoryItem {
|
||||
revision: number;
|
||||
kind: 'initial' | 'typo' | 'substantive' | 'amendment' | 'revert';
|
||||
author: string | null;
|
||||
authorInvited: boolean;
|
||||
at: string;
|
||||
diff: DiffPart[] | null;
|
||||
/** A fix someone else wrote: who let it in, or that it passed at its deadline. */
|
||||
typo: { id: string; answeredBy: string | null; deadline: boolean } | null;
|
||||
}
|
||||
|
||||
interface Detail {
|
||||
proposal: Proposal & { author: string | null; authorInvited: boolean };
|
||||
unit: { id: string; code: string; inertia: Inertia };
|
||||
inForce: { id: string; title: string; body: string } | null;
|
||||
diff: DiffPart[] | null;
|
||||
history: { revision: number; kind: 'initial' | 'typo' | 'substantive' | 'amendment'; author: string | null; authorInvited: boolean; at: string; diff: DiffPart[] | null }[];
|
||||
signals: {
|
||||
id: string; reason: string; author: string; authorInvited: boolean; mine: boolean; at: string; liftedAt: string | null; liftedBy: string | null;
|
||||
other: { id: string; title: string; status: string; code: string | null } | null;
|
||||
}[];
|
||||
history: HistoryItem[];
|
||||
objections: Objection[];
|
||||
typos: TypoFix[];
|
||||
}
|
||||
|
||||
let detail = $state<Detail | null>(null);
|
||||
@@ -49,20 +67,23 @@
|
||||
let typoSubstantive = $state(false);
|
||||
let trTitle = $state('');
|
||||
let trBody = $state('');
|
||||
let signalTarget = $state('');
|
||||
let signalReason = $state('');
|
||||
let objectionKind = $state<ObjectionKind>('contredit');
|
||||
let objectionTarget = $state('');
|
||||
let objectionReason = $state('');
|
||||
|
||||
const view = $derived(doc.view);
|
||||
const unit = $derived(doc.unit(detail?.unit.id ?? null));
|
||||
const p = $derived(detail?.proposal);
|
||||
const source = $derived(view?.doc.sourceLang ?? 'fr');
|
||||
const text = $derived(p ? shown(p, lang, source) : null);
|
||||
const votable = $derived(p?.status === 'open' || p?.status === 'in_force');
|
||||
const signalTargets = $derived(
|
||||
/** Open or in force: fixed, translated, objected to — whether held back or not. */
|
||||
const live = $derived(p?.status === 'open' || p?.status === 'in_force');
|
||||
/** The versions an objection may name: another article's, open or in force — never two texts in force. */
|
||||
const objectionTargets = $derived(
|
||||
(view?.units ?? []).flatMap((u) =>
|
||||
[u.inForce, ...u.proposals]
|
||||
.filter((x): x is Proposal => !!x && x.id !== p?.id && x.status !== 'draft' && x.kind === 'text')
|
||||
.filter((x) => !(u.id === unit?.id))
|
||||
.filter((x): x is Proposal => !!x && x.id !== p?.id && (x.status === 'open' || x.status === 'in_force') && x.kind === 'text')
|
||||
.filter((x) => u.id !== unit?.id && !(x.status === 'in_force' && p?.status === 'in_force'))
|
||||
.map((x) => ({ id: x.id, label: `${x.status === 'in_force' ? t('panel.inforce') : t('panel.proposal')} — ${x.title}` })),
|
||||
),
|
||||
);
|
||||
@@ -75,6 +96,7 @@
|
||||
typoTitle = d.proposal.title;
|
||||
typoBody = d.proposal.body;
|
||||
typoSubstantive = false;
|
||||
if (edit && d.proposal.mine && d.proposal.status === 'open') typoOpen = true;
|
||||
const tr = d.proposal.translations[lang];
|
||||
trTitle = tr?.title ?? d.proposal.title;
|
||||
trBody = tr?.body ?? d.proposal.body;
|
||||
@@ -86,6 +108,7 @@
|
||||
$effect(() => {
|
||||
void proposalId;
|
||||
void lang;
|
||||
void edit;
|
||||
void load();
|
||||
});
|
||||
|
||||
@@ -96,15 +119,36 @@
|
||||
async function refresh() {
|
||||
await doc.reload();
|
||||
await load();
|
||||
void session.refreshUnread();
|
||||
}
|
||||
|
||||
async function run(fn: () => Promise<void>) {
|
||||
busy = true;
|
||||
error = '';
|
||||
try {
|
||||
await fn();
|
||||
} catch (err) {
|
||||
error = message(err);
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function saveTypo(e: SubmitEvent) {
|
||||
e.preventDefault();
|
||||
busy = true;
|
||||
error = '';
|
||||
typoSubstantive = false;
|
||||
try {
|
||||
const r = await api.patch<{ edit: string }>(`/proposals/${proposalId}`, { title: typoTitle, body: typoBody });
|
||||
toasts.show(t(r.edit === 'substantive' ? 'propose.saved.substantive' : r.edit === 'typo' ? 'typo.done' : 'common.save'));
|
||||
const r = await api.patch<{ edit: string; typo?: { id: string; dueAt: string; answerer: 'author' | 'admin' } }>(
|
||||
`/proposals/${proposalId}`,
|
||||
{ title: typoTitle, body: typoBody },
|
||||
);
|
||||
if (r.edit === 'typo_pending' && r.typo) {
|
||||
toasts.show(t(r.typo.answerer === 'admin' ? 'typo.pending.admin' : 'typo.pending.author', { date: i18n.date(r.typo.dueAt) }), 'info', 7000);
|
||||
} else {
|
||||
toasts.show(t(r.edit === 'substantive' ? 'propose.saved.substantive' : r.edit === 'typo' ? 'typo.done' : 'common.save'));
|
||||
}
|
||||
typoOpen = false;
|
||||
await refresh();
|
||||
} catch (err) {
|
||||
@@ -118,60 +162,72 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function answerTypo(fix: TypoFix, gesture: 'validate' | 'refuse') {
|
||||
await run(async () => {
|
||||
await api.post(`/typos/${fix.id}/${gesture}`);
|
||||
toasts.show(t(gesture === 'validate' ? 'typo.validated' : 'typo.refused'));
|
||||
await refresh();
|
||||
});
|
||||
}
|
||||
|
||||
async function saveTranslation(e: SubmitEvent) {
|
||||
e.preventDefault();
|
||||
busy = true;
|
||||
try {
|
||||
await run(async () => {
|
||||
await api.put(`/proposals/${proposalId}/translations/${lang}`, { title: trTitle, body: trBody });
|
||||
toasts.show(t('translate.saved'));
|
||||
await refresh();
|
||||
} catch (err) {
|
||||
error = message(err);
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function sendSignal(e: SubmitEvent) {
|
||||
async function raise(e: SubmitEvent) {
|
||||
e.preventDefault();
|
||||
busy = true;
|
||||
try {
|
||||
await api.post(`/proposals/${proposalId}/signals`, { targetId: signalTarget, reason: signalReason });
|
||||
signalTarget = '';
|
||||
signalReason = '';
|
||||
toasts.show(t('signal.sent'));
|
||||
await run(async () => {
|
||||
await api.post(`/proposals/${proposalId}/objections`, { otherId: objectionTarget, kind: objectionKind, reason: objectionReason });
|
||||
objectionTarget = '';
|
||||
objectionReason = '';
|
||||
toasts.show(t('objection.sent'), 'info', 6000);
|
||||
await refresh();
|
||||
} catch (err) {
|
||||
error = message(err);
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function lift(id: string) {
|
||||
busy = true;
|
||||
try {
|
||||
const r = await api.post<{ entered: Entered[] }>(`/signals/${id}/lift`);
|
||||
async function settle(o: Objection, gesture: 'lift' | 'reiterate') {
|
||||
await run(async () => {
|
||||
const r = await api.post<{ entered?: Entered[] }>(`/objections/${o.id}/${gesture}`);
|
||||
toasts.show(t(gesture === 'lift' ? 'objection.done.lifted' : 'objection.done.reiterated'));
|
||||
await refresh();
|
||||
announce(doc, r.entered);
|
||||
} catch (err) {
|
||||
error = message(err);
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
announce(doc, r.entered ?? []);
|
||||
});
|
||||
}
|
||||
|
||||
async function withdraw() {
|
||||
busy = true;
|
||||
try {
|
||||
await run(async () => {
|
||||
await api.post(`/proposals/${proposalId}/withdraw`);
|
||||
toasts.show(t('propose.withdrawn'));
|
||||
await doc.reload();
|
||||
} catch (err) {
|
||||
error = message(err);
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Where an objection stands, in a few words. */
|
||||
function stateOf(o: Objection): string {
|
||||
if (o.phase === 'lifted') return t(`objection.lifted.${o.lift ?? 'objector'}` as Key);
|
||||
if (o.phase === 'objector') return t('objection.phase.objector', { date: i18n.date(o.dueAt) });
|
||||
return t('objection.phase.author');
|
||||
}
|
||||
|
||||
/** What became of a fix, or when it applies by itself. */
|
||||
function typoState(fix: TypoFix): string {
|
||||
if (fix.status === 'pending') return t('typo.status.pending', { date: i18n.date(fix.dueAt) });
|
||||
if (fix.status === 'stale') return t('typo.status.stale');
|
||||
const what = t(`typo.status.${fix.status}`);
|
||||
if (fix.settledBy === 'deadline') return `${what} · ${t('typo.settled.deadline')}`;
|
||||
if (fix.settledBy && fix.settledBy !== 'changed') return `${what} · ${t('typo.settled.by', { name: fix.settledBy })}`;
|
||||
return what;
|
||||
}
|
||||
|
||||
function typoGesture(fix: TypoFix, g: 'validate' | 'refuse'): string {
|
||||
if (fix.status === 'applied') return t('typo.undo');
|
||||
if (fix.status === 'refused') return t('typo.redo');
|
||||
return t(g === 'validate' ? 'typo.validate' : 'typo.refuse');
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -184,6 +240,7 @@
|
||||
{#if p.seedMinimal}<span class="tag water" title={t('doc.seed.long')}>{t('doc.seed')}</span>
|
||||
{:else if p.confirmedAt}<span class="tag moss">{t('doc.confirmed')}</span>
|
||||
{:else if p.enteredAt && p.status === 'in_force'}<span class="tag moss">{t('doc.adopted', { date: i18n.date(p.enteredAt) })}</span>{/if}
|
||||
{#if p.blocked}<span class="tag ochre">{t('deep.held')}</span>{/if}
|
||||
{#if p.author}{t('panel.by', { name: p.author })}{#if p.authorInvited} · {t('author.invited')}{/if}{:else if p.origin === 'seed'}{t('panel.seed.origin')}{/if}
|
||||
</p>
|
||||
</header>
|
||||
@@ -211,14 +268,14 @@
|
||||
<p class="faint note">{t('module.title.name')} · {inertiaBadge(detail.unit.inertia)}{#if text.translated} · {t('doc.lang.translation')}{#if text.stale} · <b>{t('doc.lang.stale')}</b>{/if}{/if}</p>
|
||||
{/if}
|
||||
|
||||
{#if votable}
|
||||
{#if live}
|
||||
<p class="tally faint">
|
||||
{t('tally.short', { for: p.tally.for, against: p.tally.against })}
|
||||
· <button class="linkish" type="button" onclick={() => onvote(p.id)}>{t('doc.action.vote')}</button>
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
{#if (p.kind === 'text' || p.kind === 'title') && (p.status === 'in_force' || p.origin === 'seed' || p.mine) && votable}
|
||||
{#if (p.kind === 'text' || p.kind === 'title') && live}
|
||||
<section class="sub">
|
||||
<details bind:open={typoOpen}>
|
||||
<summary>{p.mine && p.status === 'open' ? t('propose.edit') : t('typo.title')}</summary>
|
||||
@@ -236,6 +293,30 @@
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if detail.typos.length}
|
||||
<section class="sub" aria-labelledby="typos-{p.id}">
|
||||
<h4 id="typos-{p.id}">{t('typo.list')}</h4>
|
||||
<ul class="fixes">
|
||||
{#each detail.typos as fix (fix.id)}
|
||||
<li class="fix {fix.status}">
|
||||
<DiffText parts={condense(fix.diff)} />
|
||||
<p class="faint small">
|
||||
{t('typo.by', { name: fix.writer ?? '' })}{#if fix.writerInvited} · {t('author.invited')}{/if} · {i18n.date(fix.at)}
|
||||
</p>
|
||||
<p class="small state">{typoState(fix)}</p>
|
||||
{#if fix.gestures.length}
|
||||
<div class="gestures">
|
||||
{#each fix.gestures as g (g)}
|
||||
<button class="btn small" class:primary={g === 'validate' && fix.status === 'pending'} type="button" disabled={busy} onclick={() => answerTypo(fix, g)}>{typoGesture(fix, g)}</button>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if lang !== source && (p.kind === 'text' || p.kind === 'title')}
|
||||
<section class="sub">
|
||||
<details>
|
||||
@@ -256,7 +337,10 @@
|
||||
<ol class="history">
|
||||
{#each detail.history.slice(1) as h (h.at + h.revision)}
|
||||
<li>
|
||||
<p class="small"><b>{t(`history.${h.kind}`)}</b> · {i18n.date(h.at)}{#if h.author} · {t('history.by', { name: h.author })}{#if h.authorInvited} · {t('author.invited')}{/if}{/if}</p>
|
||||
<p class="small">
|
||||
<b>{t(`history.${h.kind}`)}</b> · {i18n.date(h.at)}{#if h.author} · {t('history.by', { name: h.author })}{#if h.authorInvited} · {t('author.invited')}{/if}{/if}
|
||||
{#if h.typo?.deadline} · {t('history.typo.deadline')}{:else if h.typo?.answeredBy} · {t('history.typo.validated', { name: h.typo.answeredBy })}{/if}
|
||||
</p>
|
||||
{#if h.diff}<DiffText parts={h.diff} />{/if}
|
||||
</li>
|
||||
{/each}
|
||||
@@ -264,33 +348,69 @@
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
{#if p.kind === 'text' && votable}
|
||||
<section class="sub">
|
||||
<h4>{t('signal.title')}</h4>
|
||||
{#each detail.signals as s (s.id)}
|
||||
<div class="signal" class:lifted={s.liftedAt}>
|
||||
<p class="small"><b>{s.other?.title ?? ''}</b> — {s.reason}</p>
|
||||
<p class="faint small">
|
||||
{t('signal.by', { name: s.author })}{#if s.authorInvited} · {t('author.invited')}{/if} · {i18n.date(s.at)}
|
||||
{#if s.liftedAt} · {s.liftedBy === 'revision' ? t('signal.lifted.revision') : t('signal.lifted')}{/if}
|
||||
{#if p.kind === 'text' && (live || detail.objections.length)}
|
||||
<section class="sub" aria-labelledby="objections-{p.id}">
|
||||
<h4 id="objections-{p.id}">{t('objection.title')}</h4>
|
||||
{#each detail.objections as o (o.id)}
|
||||
{@const standing = o.phase !== 'lifted'}
|
||||
<div class="objection" class:lifted={!standing}>
|
||||
<p class="small">
|
||||
<span class="tag" class:ochre={standing}>{t(`objection.kind.${o.kind}`)}</span>
|
||||
<b>{t(`objection.says.${o.kind}`, { held: o.heldVersion?.title ?? '', other: o.other.title ?? '' })}</b>
|
||||
</p>
|
||||
{#if s.mine && !s.liftedAt}<button class="btn quiet small" type="button" disabled={busy} onclick={() => lift(s.id)}>{t('signal.lift')}</button>{/if}
|
||||
<p class="reason">{o.reason}</p>
|
||||
<p class="faint small">
|
||||
{t('objection.by', { name: o.objector ?? '' })}{#if o.objectorInvited} · {t('author.invited')}{/if} · {i18n.date(o.at)}
|
||||
· {stateOf(o)}{#if standing && o.answer} · {t(`objection.answer.${o.answer}`)}{/if}
|
||||
</p>
|
||||
{#if standing && o.held}<p class="small held">{t('objection.held.here')}</p>{/if}
|
||||
{#if standing}
|
||||
<div class="gestures">
|
||||
{#if o.iAnswer && !o.mine && o.phase === 'author'}
|
||||
<button class="btn small primary" type="button" onclick={() => onanswer(o)}>{t(o.kind === 'redit' ? 'objection.respond.redit' : 'objection.respond.contredit')}</button>
|
||||
{/if}
|
||||
{#if o.canLift}
|
||||
<button class="btn small" type="button" disabled={busy} onclick={() => settle(o, 'lift')}>{t(o.mine ? 'objection.lift' : 'objection.lift.admin')}</button>
|
||||
{/if}
|
||||
{#if o.canReiterate}
|
||||
<button class="btn small quiet" type="button" disabled={busy} onclick={() => settle(o, 'reiterate')}>{t('objection.reiterate')}</button>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="faint small">{t('signal.none')}</p>
|
||||
<p class="faint small">{t('objection.none')}</p>
|
||||
{/each}
|
||||
<details>
|
||||
<summary>{t('signal.add')}</summary>
|
||||
<form class="form" onsubmit={sendSignal}>
|
||||
<p class="faint small">{t('signal.note')}</p>
|
||||
<select class="select" bind:value={signalTarget} required aria-label={t('signal.target')}>
|
||||
<option value="" disabled>{t('signal.target')}</option>
|
||||
{#each signalTargets as target (target.id)}<option value={target.id}>{target.label}</option>{/each}
|
||||
</select>
|
||||
<textarea class="textarea short" bind:value={signalReason} rows="3" minlength="10" maxlength="600" placeholder={t('signal.reason')} aria-label={t('signal.reason')}></textarea>
|
||||
<button class="btn small" type="submit" disabled={busy || !signalTarget || signalReason.trim().length < 10}>{t('signal.send')}</button>
|
||||
</form>
|
||||
</details>
|
||||
{#if live && objectionTargets.length}
|
||||
<details>
|
||||
<summary>{t('objection.add')}</summary>
|
||||
<form class="form" onsubmit={raise}>
|
||||
<p class="faint small">{t('objection.note')}</p>
|
||||
<div class="kinds" role="radiogroup" aria-label={t('objection.kind')}>
|
||||
{#each ['redit', 'contredit'] as const as k (k)}
|
||||
<label class:on={objectionKind === k}>
|
||||
<input type="radio" bind:group={objectionKind} value={k} />
|
||||
<b>{t(`objection.kind.${k}`)}</b><span class="hint">{t(`objection.kind.${k}.hint`)}</span>
|
||||
</label>
|
||||
{/each}
|
||||
</div>
|
||||
<select class="select" bind:value={objectionTarget} required aria-label={t('objection.target')}>
|
||||
<option value="" disabled>{t('objection.target')}</option>
|
||||
{#each objectionTargets as target (target.id)}<option value={target.id}>{target.label}</option>{/each}
|
||||
</select>
|
||||
<textarea
|
||||
class="textarea short"
|
||||
bind:value={objectionReason}
|
||||
rows="3"
|
||||
minlength="10"
|
||||
maxlength="600"
|
||||
placeholder={t(`objection.reason.${objectionKind}`)}
|
||||
aria-label={t(`objection.reason.${objectionKind}`)}
|
||||
></textarea>
|
||||
<button class="btn small" type="submit" disabled={busy || !objectionTarget || objectionReason.trim().length < 10}>{t('objection.send')}</button>
|
||||
</form>
|
||||
</details>
|
||||
{/if}
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
@@ -391,18 +511,88 @@
|
||||
display: grid;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
.signal {
|
||||
.fixes {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
.fix,
|
||||
.objection {
|
||||
padding: 0.6rem 0.8rem;
|
||||
border-radius: var(--r-input);
|
||||
background: var(--ochre-wash);
|
||||
display: grid;
|
||||
gap: 0.2rem;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
.signal.lifted {
|
||||
.fix {
|
||||
background: var(--water-wash);
|
||||
}
|
||||
.fix.pending .state {
|
||||
font-weight: 750;
|
||||
color: var(--water);
|
||||
}
|
||||
.fix.refused,
|
||||
.fix.stale {
|
||||
background: var(--surface-2);
|
||||
opacity: 0.8;
|
||||
}
|
||||
.objection {
|
||||
background: var(--ochre-wash);
|
||||
}
|
||||
.objection.lifted {
|
||||
background: var(--surface-2);
|
||||
opacity: 0.75;
|
||||
}
|
||||
.signal .btn {
|
||||
justify-self: start;
|
||||
.reason {
|
||||
font-family: var(--font-text);
|
||||
font-style: italic;
|
||||
color: var(--ink-soft);
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
.held {
|
||||
font-weight: 750;
|
||||
color: var(--ochre);
|
||||
}
|
||||
.gestures {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4rem;
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
.kinds {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.kinds label {
|
||||
display: grid;
|
||||
gap: 0.1rem;
|
||||
padding: 0.55rem 0.8rem;
|
||||
border-radius: var(--r-input);
|
||||
background: var(--surface-2);
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.kinds label.on {
|
||||
background: var(--ochre);
|
||||
color: var(--on-water);
|
||||
}
|
||||
.kinds label.on .hint {
|
||||
color: inherit;
|
||||
opacity: 0.85;
|
||||
}
|
||||
.kinds input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
.kinds label:has(input:focus-visible) {
|
||||
outline: 2px solid var(--water);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.hint {
|
||||
font-size: 0.8rem;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -3,17 +3,21 @@
|
||||
// vote et les autres. À combien il se rapproche du passage en vigueur. Façon
|
||||
// toggle, pas une fenêtre qui s'ouvre »): the level of the water, the totals —
|
||||
// never who voted what —, how far the threshold is, your vote and where it
|
||||
// stands, then the inertia and the formula. The rest of a version (typos,
|
||||
// translations, flags, history) lives in the panel, tab « Détails ».
|
||||
// stands, then the inertia and the formula. A version held back by an
|
||||
// objection says so, and tells each one what is theirs to do (ADR 0010). The
|
||||
// rest of a version (typos, translations, objections, history) lives in the
|
||||
// panel, tab « Détails ».
|
||||
import { onMount } from 'svelte';
|
||||
import { api } from '$lib/api';
|
||||
import type { DocState } from '$lib/doc.svelte';
|
||||
import { i18n, t } from '$lib/i18n/index.svelte';
|
||||
import { inertiaBadge, orderNote, titleOf } from '$lib/labels';
|
||||
import { holding } from '$lib/objections';
|
||||
import { moved } from '$lib/order';
|
||||
import { session } from '$lib/session.svelte';
|
||||
import { toasts } from '$lib/toast.svelte';
|
||||
import type { LevelInfo, Proposal, Unit } from '$lib/types';
|
||||
import { errorText, g1Amount, voteDirect, type Line } from '$lib/vote';
|
||||
import type { Entered, LevelInfo, Objection, Proposal, Unit } from '$lib/types';
|
||||
import { announce, errorText, g1Amount, voteDirect, type Line } from '$lib/vote';
|
||||
import Formula from './Formula.svelte';
|
||||
import InertiaPicker from './InertiaPicker.svelte';
|
||||
import WaterLevel from './WaterLevel.svelte';
|
||||
@@ -25,6 +29,7 @@
|
||||
onopen,
|
||||
onsettings,
|
||||
ondetails,
|
||||
onanswer,
|
||||
onsign,
|
||||
}: {
|
||||
doc: DocState;
|
||||
@@ -34,6 +39,8 @@
|
||||
onopen: (proposalId: string) => void;
|
||||
onsettings: (proposalId: string) => void;
|
||||
ondetails: (proposalId: string) => void;
|
||||
/** The author of a version held back answers its objection: modify the article repeated, or reword. */
|
||||
onanswer: (objection: Objection) => void;
|
||||
/** On the Ğ1 chain: the page has the lines signed by the person's wallet. */
|
||||
onsign: (lines: Line[]) => void;
|
||||
} = $props();
|
||||
@@ -42,6 +49,7 @@
|
||||
electorate: number;
|
||||
voteFloor: number;
|
||||
levels: LevelInfo[];
|
||||
objections: Objection[];
|
||||
}
|
||||
|
||||
let detail = $state<Detail | null>(null);
|
||||
@@ -52,7 +60,9 @@
|
||||
const view = $derived(doc.view);
|
||||
const access = $derived(view?.vote);
|
||||
const chain = $derived(access?.way === 'chain');
|
||||
const votable = $derived(p.status === 'open' || p.status === 'in_force');
|
||||
const live = $derived(p.status === 'open' || p.status === 'in_force');
|
||||
/** The objections holding this version back, and what each one asks of whom. */
|
||||
const held = $derived(p.blocked ? holding(detail?.objections ?? []) : []);
|
||||
const title = $derived(p.kind === 'text' ? p.title : titleOf(p, unit));
|
||||
const voted = $derived(p.myVote !== null && !p.myVoteStale);
|
||||
const ballot = $derived(p.myBallot);
|
||||
@@ -66,6 +76,9 @@
|
||||
const id = p.id;
|
||||
void p.tally.for;
|
||||
void p.tally.against;
|
||||
void p.blocked;
|
||||
void p.objections;
|
||||
void p.revision;
|
||||
api
|
||||
.get<Detail>(`/proposals/${id}`)
|
||||
.then((d) => {
|
||||
@@ -80,6 +93,22 @@
|
||||
root?.scrollIntoView({ block: 'nearest', behavior: reduce ? 'auto' : 'smooth' });
|
||||
});
|
||||
|
||||
async function settle(o: Objection, gesture: 'lift' | 'reiterate') {
|
||||
error = '';
|
||||
busy = true;
|
||||
try {
|
||||
const r = await api.post<{ entered?: Entered[] }>(`/objections/${o.id}/${gesture}`);
|
||||
toasts.show(t(gesture === 'lift' ? 'objection.done.lifted' : 'objection.done.reiterated'));
|
||||
await doc.reload();
|
||||
announce(doc, r.entered ?? []);
|
||||
void session.refreshUnread();
|
||||
} catch (e) {
|
||||
error = errorText(e);
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function cast(choice: 'for' | 'against' | null) {
|
||||
error = '';
|
||||
const lines: Line[] = [{ proposalId: p.id, choice }];
|
||||
@@ -111,7 +140,38 @@
|
||||
<p class="faint small">{inertiaBadge(p.votedAtInertia)}</p>
|
||||
</div>
|
||||
</div>
|
||||
{#if p.blocked}<p class="warn">{t('vote.blocked')}</p>{/if}
|
||||
{#if p.blocked}
|
||||
<div class="held" role="status">
|
||||
<p class="lead">{t('vote.held')}</p>
|
||||
{#each held as o (o.id)}
|
||||
<div class="objection">
|
||||
<p>
|
||||
<b>{t(o.kind === 'redit' ? 'vote.held.redit' : 'vote.held.contredit', { other: o.other.title ?? '' })}</b>
|
||||
<span class="faint">· {t('objection.by', { name: o.objector ?? '' })}</span>
|
||||
</p>
|
||||
<p class="reason">{o.reason}</p>
|
||||
{#if o.mine}
|
||||
<p>{o.phase === 'objector' ? t('vote.held.mine.asked', { date: i18n.date(o.dueAt) }) : t('vote.held.mine')}</p>
|
||||
{:else if o.phase === 'objector'}
|
||||
<p>{t('vote.held.waiting', { name: o.objector ?? '', date: i18n.date(o.dueAt) })}</p>
|
||||
{:else if o.iAnswer}
|
||||
<p>{t(o.kind === 'redit' ? 'vote.held.author.redit' : 'vote.held.author.contredit')}</p>
|
||||
{/if}
|
||||
<div class="gestures">
|
||||
{#if o.iAnswer && !o.mine && o.phase === 'author'}
|
||||
<button class="btn small primary" type="button" onclick={() => onanswer(o)}>{t(o.kind === 'redit' ? 'objection.respond.redit' : 'objection.respond.contredit')}</button>
|
||||
{/if}
|
||||
{#if o.canLift}
|
||||
<button class="btn small" type="button" disabled={busy} onclick={() => settle(o, 'lift')}>{t(o.mine ? 'objection.lift' : 'objection.lift.admin')}</button>
|
||||
{/if}
|
||||
{#if o.canReiterate}
|
||||
<button class="btn small quiet" type="button" disabled={busy} onclick={() => settle(o, 'reiterate')}>{t('objection.reiterate')}</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{#if order}
|
||||
<ol class="order" aria-label={t(p.status === 'in_force' ? 'module.order.inforce' : 'module.order.proposal')}>
|
||||
{#each order.ids as id (id)}<li class:shifted={shifted.has(id)}>{nameOf(id)}</li>{/each}
|
||||
@@ -135,10 +195,13 @@
|
||||
{:else if ballot?.status === 'expired'}
|
||||
<p class="warn">{t('vote.mine.expired')}</p>
|
||||
{/if}
|
||||
{#if p.myVoteChain || ballot}<a class="faint small" href="/bulletins">{t('vote.mine.receipts')}</a>{/if}
|
||||
</div>
|
||||
|
||||
{#if !votable}
|
||||
{#if !live}
|
||||
<p class="muted">{t('vote.closed')}</p>
|
||||
{:else if p.blocked}
|
||||
<!-- Held back: no new vote, nor a vote taken back, until the objection is lifted. -->
|
||||
{:else if access && !access.open}
|
||||
<p class="closed">{t(access.reason === 'chain_off' ? 'vote.chain.off' : 'vote.members')}</p>
|
||||
{:else if access}
|
||||
@@ -271,6 +334,34 @@
|
||||
font-weight: 700;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.held {
|
||||
display: grid;
|
||||
gap: 0.7rem;
|
||||
padding: 0.85rem 1rem;
|
||||
border-radius: var(--r-input);
|
||||
background: var(--ochre-wash);
|
||||
}
|
||||
.lead {
|
||||
font-weight: 750;
|
||||
}
|
||||
.objection {
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
.reason {
|
||||
font-family: var(--font-text);
|
||||
font-style: italic;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
.gestures {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
.gestures:empty {
|
||||
display: none;
|
||||
}
|
||||
.more {
|
||||
display: grid;
|
||||
gap: 0.9rem;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// A typo fix is a sign or two in a long text: shown around its changes only,
|
||||
// a few words on each side, the rest cut between words.
|
||||
|
||||
import type { DiffPart } from './types';
|
||||
|
||||
function head(text: string, n: number): string {
|
||||
if (text.length <= n) return text;
|
||||
let s = text.slice(0, n);
|
||||
if (!/\s/.test(text[n] ?? ' ') && /\s/.test(s)) s = s.slice(0, s.search(/\s\S*$/));
|
||||
return s.trimEnd();
|
||||
}
|
||||
|
||||
function tail(text: string, n: number): string {
|
||||
if (text.length <= n) return text;
|
||||
let s = text.slice(-n);
|
||||
if (!/\s/.test(text[text.length - n - 1] ?? ' ') && /\s/.test(s)) s = s.slice(s.search(/\s/) + 1);
|
||||
return s.trimStart();
|
||||
}
|
||||
|
||||
/** The parts of a diff, the unchanged text kept to `context` signs around each change. */
|
||||
export function condense(parts: DiffPart[], context = 40): DiffPart[] {
|
||||
if (!parts.some((p) => p.op !== 'same')) return parts;
|
||||
const last = parts.length - 1;
|
||||
return parts.map((p, i) => {
|
||||
if (p.op !== 'same') return p;
|
||||
if (i === 0) return p.text.length <= context ? p : { op: 'same', text: `… ${tail(p.text, context)}` };
|
||||
if (i === last) return p.text.length <= context ? p : { op: 'same', text: `${head(p.text, context)} …` };
|
||||
if (p.text.length <= 2 * context + 5) return p;
|
||||
return { op: 'same', text: `${head(p.text, context)} … ${tail(p.text, context)}` };
|
||||
});
|
||||
}
|
||||
@@ -19,6 +19,30 @@ export interface PanelState {
|
||||
/** The basket, opened on one section. */
|
||||
section?: string | null;
|
||||
prefill?: { title: string; body: string } | null;
|
||||
/** A new proposal that answers this objection (ADR 0010). */
|
||||
objectionId?: string | null;
|
||||
/** The details of one's own version, its edit form open: to reword it. */
|
||||
edit?: boolean;
|
||||
}
|
||||
|
||||
/** The tabs as the URL names them. */
|
||||
export const TABS: Record<string, Tab> = { panier: 'basket', propositions: 'proposals', proposer: 'propose', details: 'details', reglages: 'settings' };
|
||||
export const TAB_NAMES: Record<Tab, string> = { basket: 'panier', proposals: 'propositions', propose: 'proposer', details: 'details', settings: 'reglages' };
|
||||
|
||||
/** The query of a reader's URL: the unfolded vote and the panel. */
|
||||
export function panelSearch(panel: PanelState | null, vote: string | null): string {
|
||||
const q = new URLSearchParams();
|
||||
if (vote) q.set('vote', vote);
|
||||
if (panel) {
|
||||
q.set('onglet', TAB_NAMES[panel.tab]);
|
||||
if (panel.unitId) q.set('article', panel.unitId);
|
||||
if (panel.proposalId) q.set('version', panel.proposalId);
|
||||
if (panel.draftId) q.set('brouillon', panel.draftId);
|
||||
if (panel.section) q.set('section', panel.section);
|
||||
if (panel.objectionId) q.set('objection', panel.objectionId);
|
||||
if (panel.edit) q.set('modifier', '1');
|
||||
}
|
||||
return q.toString();
|
||||
}
|
||||
|
||||
export interface Shown {
|
||||
|
||||
+143
-19
@@ -11,6 +11,9 @@ export const en: Messages = {
|
||||
'nav.mandates': 'Mandates',
|
||||
'nav.protocols': 'Protocols',
|
||||
'nav.groups': 'My groups',
|
||||
'nav.messages': 'Messages',
|
||||
'nav.messages.count.one': 'Messages, {n} unread',
|
||||
'nav.messages.count.other': 'Messages, {n} unread',
|
||||
'nav.docs.count.one': '{label}, {n} document in progress',
|
||||
'nav.docs.count.other': '{label}, {n} documents in progress',
|
||||
'nav.access': 'Access',
|
||||
@@ -139,7 +142,7 @@ export const en: Messages = {
|
||||
'deep.addition': 'new article',
|
||||
'deep.removal': 'removal of “{title}”',
|
||||
'deep.inertia': 'inertia to {level}',
|
||||
'deep.blocked': 'blocked',
|
||||
'deep.held': 'not open to vote: objection',
|
||||
'deep.mine': 'your proposal',
|
||||
'deep.stale': 'needs reconfirming',
|
||||
'deep.wellrated': 'well-rated',
|
||||
@@ -228,7 +231,14 @@ export const en: Messages = {
|
||||
'vote.stale': 'The text has changed in substance since you voted: your vote no longer counts until you reconfirm it.',
|
||||
'vote.reconfirm': 'Reconfirm: {choice}',
|
||||
'vote.private': 'Nobody sees your vote: only the totals are visible.',
|
||||
'vote.blocked': "A contradiction flag is holding it back: it can't come into force while the flag stands.",
|
||||
'vote.held': 'An objection is holding this version back: it cannot be voted on until the objection is lifted. Votes already cast stay.',
|
||||
'vote.held.redit': 'It repeats “{other}”.',
|
||||
'vote.held.contredit': 'It contradicts “{other}”.',
|
||||
'vote.held.author.redit': 'For it to be voted on again, change the article it repeats. The person who raised the objection then lifts it or reiterates it; with no answer from them within 3 days, it is lifted.',
|
||||
'vote.held.author.contredit': 'For it to be voted on again, reword it. The person who raised the objection then lifts it or reiterates it; with no answer from them within 3 days, it is lifted.',
|
||||
'vote.held.waiting': 'An answer came: {name} lifts or reiterates the objection by {date}; with no answer, it is lifted.',
|
||||
'vote.held.mine': 'You raised this objection: lift it when the answer suits you.',
|
||||
'vote.held.mine.asked': 'An answer came: lift your objection if it suits you, or reiterate it, by {date}. With no answer from you, it is lifted.',
|
||||
'vote.entered': '“{title}” has come into force.',
|
||||
'vote.entered.remove': '“{title}” has been removed from the text in force.',
|
||||
'vote.entered.inertia': 'The inertia of “{title}” has changed.',
|
||||
@@ -244,14 +254,15 @@ export const en: Messages = {
|
||||
'vote.mine.pending': 'Waiting for the Ğ1 chain: {choice}.',
|
||||
'vote.mine.refused': 'Your last vote was not counted: {reason}',
|
||||
'vote.mine.expired': 'Your last vote was not seen on the Ğ1 chain in time: it does not count.',
|
||||
'vote.mine.receipts': 'Your ballots and receipts',
|
||||
'vote.choice.for': 'for',
|
||||
'vote.choice.against': 'against',
|
||||
'vote.choice.none': 'withdrawing your vote',
|
||||
'vote.chain.note': 'Your vote leaves from your Ğ1 wallet: {amount} Ğ1, in a single gesture. The chain shows that you voted, never what you voted.',
|
||||
'vote.chain.counts': 'Your voice counts for the Ğ1 identity of the wallet that signs, if it is a member of the web of trust.',
|
||||
'vote.chain.off': 'Voting through the Ğ1 chain is not open yet: the account that receives the votes is still to be created. You can read, propose and flag a contradiction.',
|
||||
'vote.chain.off': 'Voting through the Ğ1 chain is not open yet: the account that receives the votes is still to be created. You can read, propose and raise an objection.',
|
||||
'vote.members': 'Only members of this group vote here.',
|
||||
'vote.details': 'Typos, translations, flags, history',
|
||||
'vote.details': 'Typos, translations, objections, history',
|
||||
'ballot.reason.not_member': 'the wallet that signed is not that of a member of the Ğ1 web of trust.',
|
||||
'ballot.reason.no_identity': 'the wallet that signed is linked to no Ğ1 identity.',
|
||||
'ballot.reason.transfer': 'the transfer to the vote account is missing, or its amount is too low.',
|
||||
@@ -278,6 +289,7 @@ export const en: Messages = {
|
||||
'basket.sent.other': '{n} votes saved.',
|
||||
'basket.section': 'Vote on this section',
|
||||
'basket.mine': 'your vote: {choice}',
|
||||
'basket.held': 'not open to vote: an objection holds it back',
|
||||
'sign.title': 'Vote with your Ğ1 wallet',
|
||||
'sign.summary.one': '{n} vote, in one transaction: {amount} Ğ1 to the vote account, with your sealed ballot.',
|
||||
'sign.summary.other': '{n} votes, in one transaction: {amount} Ğ1 to the vote account, with your sealed ballot.',
|
||||
@@ -305,6 +317,38 @@ export const en: Messages = {
|
||||
'sign.close': 'Close',
|
||||
'sign.later': 'You can close: the confirmation will arrive on its own, and your vote will appear under the article.',
|
||||
'sign.retry': 'Try again',
|
||||
'sign.error.chain': 'The Ğ1 chain refused the transaction: your vote did not leave. Try again whenever you like.',
|
||||
'sign.receipt': 'Download your receipt',
|
||||
'sign.history': 'Your ballots',
|
||||
'sign.receipt.note': 'Your receipt keeps your ballot and its salt: with it, you check for yourself that the chain carries your vote. Keep it to yourself.',
|
||||
|
||||
'ballots.title': 'Your ballots',
|
||||
'ballots.intro': 'Each vote on the Ğ1 chain leaves in a sealed ballot: the chain shows that you voted, never what you voted. Your receipt keeps the ballot and its salt; with it, you check your vote for yourself. Nobody else receives it.',
|
||||
'ballots.mine': 'Your ballots',
|
||||
'ballots.signin': 'Sign in to find your ballots.',
|
||||
'ballots.none': 'You have not sent any ballot on the Ğ1 chain yet.',
|
||||
'ballots.lines.one': '{n} vote',
|
||||
'ballots.lines.other': '{n} votes',
|
||||
'ballots.status.pending': 'Waiting for the Ğ1 chain',
|
||||
'ballots.status.confirmed': 'Counted for the Ğ1 identity “{name}”',
|
||||
'ballots.status.refused': 'Not counted: {reason}',
|
||||
'ballots.status.expired': 'Not seen on the Ğ1 chain in time: it does not count',
|
||||
'ballots.block': 'block {n}',
|
||||
'ballots.receipt': 'Download the receipt',
|
||||
'ballots.verify.title': 'Check a receipt',
|
||||
'ballots.verify.intro': 'Choose the file of a receipt, or paste its content: the page recomputes the seal of the ballot right here, without asking the server anything.',
|
||||
'ballots.verify.file': 'Receipt file',
|
||||
'ballots.verify.paste': 'Or paste the receipt',
|
||||
'ballots.verify.go': 'Check',
|
||||
'ballots.verify.ok': 'The receipt holds: its votes and its salt give this very comment.',
|
||||
'ballots.verify.line': 'Version {version}, revision {revision}: {choice}',
|
||||
'ballots.verify.line.label': '{label} — written in the receipt, outside the seal',
|
||||
'ballots.verify.where': 'Look for this comment in the history of your wallet: it is your vote, written on the Ğ1 chain.',
|
||||
'ballots.verify.where.block': 'Look for this comment in the history of your wallet, or on the Ğ1 chain (the receipt says block {block}, outside the seal): if it is there, signed by your account, it is your vote.',
|
||||
'ballots.verify.bad': 'The receipt does not hold: its votes and its salt do not give its comment.',
|
||||
'ballots.verify.computed': 'Recomputed:',
|
||||
'ballots.verify.expected': 'In the receipt:',
|
||||
'ballots.verify.unreadable': 'This is not a readable vote receipt.',
|
||||
|
||||
'inertia.title': 'Inertia',
|
||||
'inertia.explain': 'The higher the inertia, the more votes it takes to change this text when few people vote.',
|
||||
@@ -359,27 +403,98 @@ export const en: Messages = {
|
||||
'history.typo': 'typo fixed',
|
||||
'history.substantive': 'substantive change (votes to reconfirm)',
|
||||
'history.amendment': 'starting text replaced',
|
||||
'history.revert': 'fix taken back by the author',
|
||||
'history.by': 'by {name}',
|
||||
'history.typo.validated': 'validated by {name}',
|
||||
'history.typo.deadline': 'applied with no answer within 3 days',
|
||||
|
||||
'typo.title': 'Fix a typo',
|
||||
'typo.note': 'Accents, capitals, typos, words run together or split: the fix applies without a vote, with its author and its diff. Punctuation, figures, formulas, addresses and any change in meaning go through a proposal.',
|
||||
'typo.note': "Accents, capitals, typos, words run together or split: the fix is not voted on. On your own text, it applies at once. On someone else's, its author validates it (an administrator for a seed text); with no answer within 3 days, it applies. Punctuation, figures, formulas, addresses and any change in meaning go through a proposal.",
|
||||
'typo.save': 'Save the fix',
|
||||
'typo.done': 'Typo fixed, votes untouched.',
|
||||
'typo.substantive': 'This edit affects the meaning: propose it as a change.',
|
||||
'typo.asProposal': 'Make it a proposal',
|
||||
'typo.pending.author': 'Your fix waits for the author of the text: it applies when they validate it, or by itself on {date}.',
|
||||
'typo.pending.admin': 'Your fix waits for an administrator, as this text comes from the seed: it applies when they validate it, or by itself on {date}.',
|
||||
'typo.list': 'Suggested typo fixes',
|
||||
'typo.by': 'suggested by {name}',
|
||||
'typo.status.pending': 'waiting: applies by itself on {date}',
|
||||
'typo.status.applied': 'applied',
|
||||
'typo.status.refused': 'refused',
|
||||
'typo.status.stale': 'out of date: the text changed meanwhile',
|
||||
'typo.settled.by': 'by {name}',
|
||||
'typo.settled.deadline': 'with no answer within 3 days',
|
||||
'typo.validate': 'Validate',
|
||||
'typo.refuse': 'Refuse',
|
||||
'typo.undo': 'Go back to the text before',
|
||||
'typo.redo': 'Apply after all',
|
||||
'typo.validated': 'Fix applied.',
|
||||
'typo.refused': 'Fix refused.',
|
||||
|
||||
'signal.title': 'Contradictions',
|
||||
'signal.none': 'No flags.',
|
||||
'signal.add': 'Flag a contradiction',
|
||||
'signal.target': 'Contradicts',
|
||||
'signal.reason': 'How these two texts contradict each other',
|
||||
'signal.send': 'Flag',
|
||||
'signal.sent': 'Flag saved.',
|
||||
'signal.note': "While a flag stands, these two texts can't be in force together. Its author lifts it; a substantive change makes it lapse.",
|
||||
'signal.lift': 'Lift',
|
||||
'signal.lifted': 'lifted',
|
||||
'signal.lifted.revision': 'lapsed: the text changed',
|
||||
'signal.by': 'by {name}',
|
||||
'objection.title': 'Objections',
|
||||
'objection.none': 'No objection.',
|
||||
'objection.add': 'Raise an objection',
|
||||
'objection.kind': 'Your objection',
|
||||
'objection.kind.redit': 'Repeats',
|
||||
'objection.kind.contredit': 'Contradicts',
|
||||
'objection.kind.redit.hint': 'this text repeats another article',
|
||||
'objection.kind.contredit.hint': 'this text says the opposite of another article',
|
||||
'objection.target': 'Which article?',
|
||||
'objection.reason.redit': 'How these two texts say the same thing',
|
||||
'objection.reason.contredit': 'How these two texts contradict each other',
|
||||
'objection.send': 'Send the objection',
|
||||
'objection.sent': 'Objection saved: the later of the two versions cannot be voted on until it is lifted.',
|
||||
'objection.note': 'An objection makes the later of the two versions not open to vote until it is lifted — never a text in force. Its author answers: for a repetition, they change the article it repeats; for a contradiction, they reword. You then lift the objection or reiterate it; with no answer from you within 3 days, it is lifted.',
|
||||
'objection.says.redit': '“{held}” repeats “{other}”',
|
||||
'objection.says.contredit': '“{held}” contradicts “{other}”',
|
||||
'objection.by': 'objection by {name}',
|
||||
'objection.held.here': 'this version cannot be voted on',
|
||||
'objection.phase.author': "waiting for the author's answer",
|
||||
'objection.phase.objector': 'answer received: lifted or reiterated by {date}, otherwise lifted by itself',
|
||||
'objection.answer.revision': 'answer: the held text was reworded',
|
||||
'objection.answer.other': 'answer: the other text changed',
|
||||
'objection.answer.proposal': 'answer: a linked proposal',
|
||||
'objection.lifted.objector': 'lifted by the person who raised it',
|
||||
'objection.lifted.admin': 'lifted by an administrator',
|
||||
'objection.lifted.deadline': 'lifted: 3 days without follow-up',
|
||||
'objection.lifted.withdrawn': 'lifted: the proposal was withdrawn',
|
||||
'objection.lifted.revision': 'lapsed: the text changed',
|
||||
'objection.lift': 'Lift the objection',
|
||||
'objection.lift.admin': 'Lift the objection (administrator)',
|
||||
'objection.reiterate': 'Reiterate the objection',
|
||||
'objection.done.lifted': 'Objection lifted.',
|
||||
'objection.done.reiterated': 'Objection reiterated: a new answer is awaited.',
|
||||
'objection.respond.redit': 'Change the article it repeats',
|
||||
'objection.respond.contredit': 'Reword',
|
||||
'objection.linked': 'This proposal answers an objection: once submitted, the person who raised it lifts it or reiterates it.',
|
||||
'messages.title': 'Messages',
|
||||
'messages.intro': 'What waits for a gesture from you: an objection to answer, a typo fix to validate. Each message carries its deadline; a message dealt with asks nothing more.',
|
||||
'messages.none': 'No messages for now.',
|
||||
'messages.readAll': 'Mark all as read',
|
||||
'messages.read': 'Mark as read',
|
||||
'messages.unread': 'unread',
|
||||
'messages.due': 'deadline: {date}',
|
||||
'messages.open': 'See it in the text',
|
||||
'messages.topic.objection': 'Objection',
|
||||
'messages.topic.typo': 'Typo',
|
||||
'messages.objection_raised.redit': '{name} raises an objection: your version “{held}” repeats “{other}”. It cannot be voted on until the objection is lifted. To answer, change the article it repeats.',
|
||||
'messages.objection_raised.contredit': '{name} raises an objection: your version “{held}” contradicts “{other}”. It cannot be voted on until the objection is lifted. To answer, reword it.',
|
||||
'messages.objection_reiterated': '{name} reiterates their objection: “{held}” still cannot be voted on. Answer again.',
|
||||
'messages.objection_answered': 'Your objection on “{held}” has been answered. Lift it if the answer suits you, or reiterate it. With no answer from you, it is lifted.',
|
||||
'messages.typo_pending.author': '{name} suggests a typo fix in your version “{title}”.',
|
||||
'messages.typo_pending.admin': '{name} suggests a typo fix in “{title}”, a seed text: an administrator validates it.',
|
||||
'messages.respond': 'Answer',
|
||||
'messages.outcome.answered': 'answered',
|
||||
'messages.outcome.reiterated': 'objection reiterated',
|
||||
'messages.outcome.lifted': 'objection lifted',
|
||||
'messages.outcome.admin': 'objection lifted by an administrator',
|
||||
'messages.outcome.deadline.objection': 'objection lifted: 3 days without follow-up',
|
||||
'messages.outcome.deadline.typo': 'fix applied: 3 days without an answer',
|
||||
'messages.outcome.withdrawn': 'proposal withdrawn',
|
||||
'messages.outcome.applied': 'fix applied',
|
||||
'messages.outcome.refused': 'fix refused',
|
||||
'messages.outcome.stale': 'fix out of date: the text changed',
|
||||
'messages.outcome.done': 'dealt with',
|
||||
|
||||
'propose.mode.replace': 'Change this text',
|
||||
'propose.mode.remove': 'Remove this article',
|
||||
@@ -490,7 +605,7 @@ export const en: Messages = {
|
||||
'error.internal': 'Something failed on our side. Try again in a moment.',
|
||||
'error.title': 'The title is empty or too long (120 characters max).',
|
||||
'error.body': 'The text is empty or too long (4,000 characters max).',
|
||||
'error.reason': 'Say in a few words how these texts contradict each other (10 to 600 characters).',
|
||||
'error.reason': 'Say in a few words what your objection rests on (10 to 600 characters).',
|
||||
'error.substantive_not_author': "This edit affects the meaning: only the proposal's author can make it. Propose your own version.",
|
||||
'error.substantive_in_force': 'This edit affects the meaning: propose it as a change.',
|
||||
'error.same_unit': "These two texts target the same article: they can't be in force together anyway.",
|
||||
@@ -509,7 +624,7 @@ export const en: Messages = {
|
||||
'error.chain_vote_off': 'Voting through the Ğ1 chain is not open yet.',
|
||||
'error.chain_only': 'Here, the vote goes through the Ğ1 chain, with your wallet.',
|
||||
'error.server_vote': 'Here, voting is direct, without a wallet.',
|
||||
'error.too_many_ballots': 'You already have many votes waiting for the Ğ1 chain: wait for them to be confirmed.',
|
||||
'error.too_many_ballots': 'You already have many ballots waiting, or left on the way within the hour: wait for them to be confirmed, or try again a little later.',
|
||||
'error.lines': 'This vote no longer holds: reload the page, then start again.',
|
||||
'error.choice': 'This choice does not exist.',
|
||||
'error.author': 'This account is not a Ğ1 address.',
|
||||
@@ -523,6 +638,15 @@ export const en: Messages = {
|
||||
'error.not_a_title': 'This module is not the title of the document.',
|
||||
'error.same_title': 'This is already the title in force.',
|
||||
'error.section': 'This section does not exist in this document.',
|
||||
'error.objection': 'An objection is holding this version back: it cannot be voted on until the objection is lifted.',
|
||||
'error.kind': 'Say whether this text repeats the other or contradicts it.',
|
||||
'error.other': 'Choose another article, in force or proposed.',
|
||||
'error.both_in_force': 'Both texts are in force: an objection always targets a version that is not in force yet.',
|
||||
'error.objection_exists': 'You already have an objection standing on these two texts.',
|
||||
'error.nothing_to_reiterate': 'Nothing to reiterate: no answer has come yet.',
|
||||
'error.lifted': 'This objection is already lifted.',
|
||||
'error.settled': 'This fix is already decided.',
|
||||
'error.link': 'This proposal cannot answer this objection: it targets another article, or the objection is lifted.',
|
||||
'error.retry': 'Try again',
|
||||
|
||||
'common.cancel': 'Cancel',
|
||||
|
||||
+143
-19
@@ -11,6 +11,9 @@ export const es: Messages = {
|
||||
'nav.mandates': 'Mandatos',
|
||||
'nav.protocols': 'Protocolos',
|
||||
'nav.groups': 'Mis grupos',
|
||||
'nav.messages': 'Mensajes',
|
||||
'nav.messages.count.one': 'Mensajes, {n} sin leer',
|
||||
'nav.messages.count.other': 'Mensajes, {n} sin leer',
|
||||
'nav.docs.count.one': '{label}, {n} documento en curso',
|
||||
'nav.docs.count.other': '{label}, {n} documentos en curso',
|
||||
'nav.access': 'Accesos',
|
||||
@@ -139,7 +142,7 @@ export const es: Messages = {
|
||||
'deep.addition': 'artículo nuevo',
|
||||
'deep.removal': 'retirada de «{title}»',
|
||||
'deep.inertia': 'inercia a {level}',
|
||||
'deep.blocked': 'bloqueada',
|
||||
'deep.held': 'no votable: objeción',
|
||||
'deep.mine': 'tu propuesta',
|
||||
'deep.stale': 'por reconfirmar',
|
||||
'deep.wellrated': 'bien valorada',
|
||||
@@ -228,7 +231,14 @@ export const es: Messages = {
|
||||
'vote.stale': 'El texto ha cambiado de fondo desde tu voto: tu voto deja de contar hasta que lo reconfirmes.',
|
||||
'vote.reconfirm': 'Reconfirmar: {choice}',
|
||||
'vote.private': 'Tu voto no se muestra a nadie: solo se ven los totales.',
|
||||
'vote.blocked': 'Un aviso de contradicción la retiene: no puede entrar en vigor mientras se mantenga.',
|
||||
'vote.held': 'Una objeción retiene esta versión: no se vota hasta que se levante. Los votos ya emitidos se mantienen.',
|
||||
'vote.held.redit': 'Repite «{other}».',
|
||||
'vote.held.contredit': 'Contradice «{other}».',
|
||||
'vote.held.author.redit': 'Para que vuelva a votarse, modifica el artículo que repite. La persona que hizo la objeción la levanta entonces o la reitera; sin respuesta suya en 3 días, se levanta.',
|
||||
'vote.held.author.contredit': 'Para que vuelva a votarse, reformúlala. La persona que hizo la objeción la levanta entonces o la reitera; sin respuesta suya en 3 días, se levanta.',
|
||||
'vote.held.waiting': 'Llegó una respuesta: {name} levanta o reitera la objeción antes del {date}; sin respuesta, se levanta.',
|
||||
'vote.held.mine': 'Hiciste esta objeción: levántala cuando la respuesta te convenga.',
|
||||
'vote.held.mine.asked': 'Llegó una respuesta: levanta tu objeción si te convence, o reitérala, antes del {date}. Sin respuesta tuya, se levanta.',
|
||||
'vote.entered': '«{title}» ha entrado en vigor.',
|
||||
'vote.entered.remove': '«{title}» se ha retirado del texto en vigor.',
|
||||
'vote.entered.inertia': 'La inercia de «{title}» ha cambiado.',
|
||||
@@ -244,14 +254,15 @@ export const es: Messages = {
|
||||
'vote.mine.pending': 'Esperando a la cadena Ğ1: {choice}.',
|
||||
'vote.mine.refused': 'Tu último voto no se contó: {reason}',
|
||||
'vote.mine.expired': 'Tu último voto no se vio a tiempo en la cadena Ğ1: no cuenta.',
|
||||
'vote.mine.receipts': 'Tus papeletas y recibos',
|
||||
'vote.choice.for': 'a favor',
|
||||
'vote.choice.against': 'en contra',
|
||||
'vote.choice.none': 'retirar tu voto',
|
||||
'vote.chain.note': 'Tu voto sale de tu monedero Ğ1: {amount} Ğ1, en un solo gesto. La cadena muestra que has votado, nunca lo que has votado.',
|
||||
'vote.chain.counts': 'Tu voz cuenta para la identidad Ğ1 del monedero que firma, si es miembro de la red de confianza.',
|
||||
'vote.chain.off': 'La votación por la cadena Ğ1 aún no está abierta: falta crear la cuenta que recibe los votos. Puedes leer, proponer y señalar una contradicción.',
|
||||
'vote.chain.off': 'La votación por la cadena Ğ1 aún no está abierta: falta crear la cuenta que recibe los votos. Puedes leer, proponer y hacer una objeción.',
|
||||
'vote.members': 'Aquí solo votan los miembros de este grupo.',
|
||||
'vote.details': 'Erratas, traducciones, señalamientos, historial',
|
||||
'vote.details': 'Erratas, traducciones, objeciones, historial',
|
||||
'ballot.reason.not_member': 'el monedero que firmó no es el de un miembro de la red de confianza Ğ1.',
|
||||
'ballot.reason.no_identity': 'el monedero que firmó no está vinculado a ninguna identidad Ğ1.',
|
||||
'ballot.reason.transfer': 'falta la transferencia a la cuenta de los votos, o su importe es demasiado bajo.',
|
||||
@@ -278,6 +289,7 @@ export const es: Messages = {
|
||||
'basket.sent.other': '{n} votos registrados.',
|
||||
'basket.section': 'Votar esta sección',
|
||||
'basket.mine': 'tu voto: {choice}',
|
||||
'basket.held': 'no votable: una objeción la retiene',
|
||||
'sign.title': 'Votar con tu monedero Ğ1',
|
||||
'sign.summary.one': '{n} voto, en una transacción: {amount} Ğ1 a la cuenta de los votos, con tu papeleta sellada.',
|
||||
'sign.summary.other': '{n} votos, en una transacción: {amount} Ğ1 a la cuenta de los votos, con tu papeleta sellada.',
|
||||
@@ -305,6 +317,38 @@ export const es: Messages = {
|
||||
'sign.close': 'Cerrar',
|
||||
'sign.later': 'Puedes cerrar: la confirmación llegará sola, y tu voto aparecerá bajo el artículo.',
|
||||
'sign.retry': 'Reintentar',
|
||||
'sign.error.chain': 'La cadena Ğ1 rechazó la transacción: tu voto no salió. Vuelve a intentarlo cuando quieras.',
|
||||
'sign.receipt': 'Descargar tu recibo',
|
||||
'sign.history': 'Tus papeletas',
|
||||
'sign.receipt.note': 'Tu recibo guarda tu papeleta y su sal: con él, compruebas por tu cuenta que la cadena lleva tu voto. Guárdalo para ti.',
|
||||
|
||||
'ballots.title': 'Tus papeletas de voto',
|
||||
'ballots.intro': 'Cada voto por la cadena Ğ1 sale en una papeleta sellada: la cadena muestra que votaste, nunca lo que votaste. Tu recibo guarda la papeleta y su sal; con él, compruebas tu voto por tu cuenta. Nadie más lo recibe.',
|
||||
'ballots.mine': 'Tus papeletas',
|
||||
'ballots.signin': 'Conéctate para encontrar tus papeletas.',
|
||||
'ballots.none': 'Aún no has enviado ninguna papeleta por la cadena Ğ1.',
|
||||
'ballots.lines.one': '{n} voto',
|
||||
'ballots.lines.other': '{n} votos',
|
||||
'ballots.status.pending': 'Esperando a la cadena Ğ1',
|
||||
'ballots.status.confirmed': 'Contado para la identidad Ğ1 «{name}»',
|
||||
'ballots.status.refused': 'No contado: {reason}',
|
||||
'ballots.status.expired': 'No visto a tiempo en la cadena Ğ1: no cuenta',
|
||||
'ballots.block': 'bloque {n}',
|
||||
'ballots.receipt': 'Descargar el recibo',
|
||||
'ballots.verify.title': 'Comprobar un recibo',
|
||||
'ballots.verify.intro': 'Elige el archivo de un recibo, o pega su contenido: la página recalcula el sello de la papeleta aquí mismo, sin pedir nada al servidor.',
|
||||
'ballots.verify.file': 'Archivo del recibo',
|
||||
'ballots.verify.paste': 'O pega el recibo',
|
||||
'ballots.verify.go': 'Comprobar',
|
||||
'ballots.verify.ok': 'El recibo es válido: sus votos y su sal dan exactamente este comentario.',
|
||||
'ballots.verify.line': 'Versión {version}, revisión {revision}: {choice}',
|
||||
'ballots.verify.line.label': '{label} — anotado en el recibo, fuera del sello',
|
||||
'ballots.verify.where': 'Busca este comentario en el historial de tu monedero: es tu voto, inscrito en la cadena Ğ1.',
|
||||
'ballots.verify.where.block': 'Busca este comentario en el historial de tu monedero, o en la cadena Ğ1 (el recibo indica el bloque {block}, fuera del sello): si figura allí, firmado por tu cuenta, es tu voto.',
|
||||
'ballots.verify.bad': 'El recibo no es válido: sus votos y su sal no dan su comentario.',
|
||||
'ballots.verify.computed': 'Recalculado:',
|
||||
'ballots.verify.expected': 'En el recibo:',
|
||||
'ballots.verify.unreadable': 'No es un recibo de voto legible.',
|
||||
|
||||
'inertia.title': 'Inercia',
|
||||
'inertia.explain': 'Cuanto más alta es la inercia, más votos hacen falta para cambiar este texto cuando vota poca gente.',
|
||||
@@ -359,27 +403,98 @@ export const es: Messages = {
|
||||
'history.typo': 'errata corregida',
|
||||
'history.substantive': 'cambio de fondo (votos por reconfirmar)',
|
||||
'history.amendment': 'texto de partida sustituido',
|
||||
'history.revert': 'corrección retirada por el autor',
|
||||
'history.by': 'por {name}',
|
||||
'history.typo.validated': 'validada por {name}',
|
||||
'history.typo.deadline': 'aplicada sin respuesta en 3 días',
|
||||
|
||||
'typo.title': 'Corregir una errata',
|
||||
'typo.note': 'Acentos, mayúsculas, erratas, palabras pegadas o separadas: la corrección se aplica sin votación, con su autor y su diff. La puntuación, las cifras, las fórmulas, las direcciones y todo cambio de sentido pasan por una propuesta.',
|
||||
'typo.note': 'Acentos, mayúsculas, erratas, palabras pegadas o separadas: la corrección no se vota. En tu texto, se aplica enseguida. En el de otra persona, su autor la valida (un administrador para un texto del seed); sin respuesta en 3 días, se aplica. La puntuación, las cifras, las fórmulas, las direcciones y todo cambio de sentido pasan por una propuesta.',
|
||||
'typo.save': 'Guardar la corrección',
|
||||
'typo.done': 'Errata corregida, sin tocar los votos.',
|
||||
'typo.substantive': 'Este cambio afecta al sentido: proponlo como modificación.',
|
||||
'typo.asProposal': 'Convertirlo en propuesta',
|
||||
'typo.pending.author': 'Tu corrección espera al autor del texto: se aplica cuando la valida, o sola el {date}.',
|
||||
'typo.pending.admin': 'Tu corrección espera a un administrador, porque este texto viene del seed: se aplica cuando la valida, o sola el {date}.',
|
||||
'typo.list': 'Erratas propuestas',
|
||||
'typo.by': 'propuesta por {name}',
|
||||
'typo.status.pending': 'en espera: se aplica sola el {date}',
|
||||
'typo.status.applied': 'aplicada',
|
||||
'typo.status.refused': 'rechazada',
|
||||
'typo.status.stale': 'caducada: el texto cambió entretanto',
|
||||
'typo.settled.by': 'por {name}',
|
||||
'typo.settled.deadline': 'sin respuesta en 3 días',
|
||||
'typo.validate': 'Validar',
|
||||
'typo.refuse': 'Rechazar',
|
||||
'typo.undo': 'Volver al texto anterior',
|
||||
'typo.redo': 'Aplicar al final',
|
||||
'typo.validated': 'Corrección aplicada.',
|
||||
'typo.refused': 'Corrección rechazada.',
|
||||
|
||||
'signal.title': 'Contradicciones',
|
||||
'signal.none': 'Ningún aviso.',
|
||||
'signal.add': 'Señalar una contradicción',
|
||||
'signal.target': 'Contradice',
|
||||
'signal.reason': 'En qué se contradicen estos dos textos',
|
||||
'signal.send': 'Señalar',
|
||||
'signal.sent': 'Aviso registrado.',
|
||||
'signal.note': 'Mientras un aviso se mantenga, estos dos textos no pueden estar en vigor a la vez. Su autor lo levanta; un cambio de fondo lo deja sin efecto.',
|
||||
'signal.lift': 'Levantar',
|
||||
'signal.lifted': 'levantado',
|
||||
'signal.lifted.revision': 'sin efecto: el texto ha cambiado',
|
||||
'signal.by': 'por {name}',
|
||||
'objection.title': 'Objeciones',
|
||||
'objection.none': 'Ninguna objeción.',
|
||||
'objection.add': 'Hacer una objeción',
|
||||
'objection.kind': 'Tu objeción',
|
||||
'objection.kind.redit': 'Repite',
|
||||
'objection.kind.contredit': 'Contradice',
|
||||
'objection.kind.redit.hint': 'este texto repite otro artículo',
|
||||
'objection.kind.contredit.hint': 'este texto dice lo contrario de otro artículo',
|
||||
'objection.target': '¿Qué artículo?',
|
||||
'objection.reason.redit': 'En qué dicen lo mismo estos dos textos',
|
||||
'objection.reason.contredit': 'En qué se contradicen estos dos textos',
|
||||
'objection.send': 'Enviar la objeción',
|
||||
'objection.sent': 'Objeción registrada: la más reciente de las dos versiones no se vota hasta que se levante.',
|
||||
'objection.note': 'Una objeción hace no votable la más reciente de las dos versiones hasta que se levante — nunca un texto en vigor. Su autor responde: para una repetición, modifica el artículo que repite; para una contradicción, reformula. Tú levantas entonces la objeción o la reiteras; sin respuesta tuya en 3 días, se levanta.',
|
||||
'objection.says.redit': '«{held}» repite «{other}»',
|
||||
'objection.says.contredit': '«{held}» contradice «{other}»',
|
||||
'objection.by': 'objeción de {name}',
|
||||
'objection.held.here': 'esta versión no se vota',
|
||||
'objection.phase.author': 'en espera de la respuesta del autor',
|
||||
'objection.phase.objector': 'respuesta recibida: levantada o reiterada antes del {date}, si no se levanta sola',
|
||||
'objection.answer.revision': 'respuesta: el texto retenido se reformuló',
|
||||
'objection.answer.other': 'respuesta: el otro texto cambió',
|
||||
'objection.answer.proposal': 'respuesta: una propuesta vinculada',
|
||||
'objection.lifted.objector': 'levantada por la persona que la hizo',
|
||||
'objection.lifted.admin': 'levantada por un administrador',
|
||||
'objection.lifted.deadline': 'levantada: 3 días sin continuación',
|
||||
'objection.lifted.withdrawn': 'levantada: la propuesta se retiró',
|
||||
'objection.lifted.revision': 'caída: el texto cambió',
|
||||
'objection.lift': 'Levantar la objeción',
|
||||
'objection.lift.admin': 'Levantar la objeción (administrador)',
|
||||
'objection.reiterate': 'Reiterar la objeción',
|
||||
'objection.done.lifted': 'Objeción levantada.',
|
||||
'objection.done.reiterated': 'Objeción reiterada: se espera una nueva respuesta.',
|
||||
'objection.respond.redit': 'Modificar el artículo que repite',
|
||||
'objection.respond.contredit': 'Reformular',
|
||||
'objection.linked': 'Esta propuesta responde a una objeción: una vez enviada, la persona que la hizo la levanta o la reitera.',
|
||||
'messages.title': 'Mensajes',
|
||||
'messages.intro': 'Lo que espera un gesto tuyo: una objeción que responder, una corrección de errata que validar. Cada mensaje lleva su plazo; un mensaje tratado ya no pide nada.',
|
||||
'messages.none': 'Ningún mensaje por ahora.',
|
||||
'messages.readAll': 'Marcar todo como leído',
|
||||
'messages.read': 'Marcar como leído',
|
||||
'messages.unread': 'sin leer',
|
||||
'messages.due': 'plazo: {date}',
|
||||
'messages.open': 'Verlo en el texto',
|
||||
'messages.topic.objection': 'Objeción',
|
||||
'messages.topic.typo': 'Errata',
|
||||
'messages.objection_raised.redit': '{name} hace una objeción: tu versión «{held}» repite «{other}». No se vota hasta que se levante. Para responder, modifica el artículo que repite.',
|
||||
'messages.objection_raised.contredit': '{name} hace una objeción: tu versión «{held}» contradice «{other}». No se vota hasta que se levante. Para responder, reformúlala.',
|
||||
'messages.objection_reiterated': '{name} reitera su objeción: «{held}» sigue sin votarse. Responde de nuevo.',
|
||||
'messages.objection_answered': 'Tu objeción sobre «{held}» recibió una respuesta. Levántala si te convence, o reitérala. Sin respuesta tuya, se levanta.',
|
||||
'messages.typo_pending.author': '{name} propone una corrección de errata en tu versión «{title}».',
|
||||
'messages.typo_pending.admin': '{name} propone una corrección de errata en «{title}», un texto del seed: un administrador la valida.',
|
||||
'messages.respond': 'Responder',
|
||||
'messages.outcome.answered': 'respuesta dada',
|
||||
'messages.outcome.reiterated': 'objeción reiterada',
|
||||
'messages.outcome.lifted': 'objeción levantada',
|
||||
'messages.outcome.admin': 'objeción levantada por un administrador',
|
||||
'messages.outcome.deadline.objection': 'objeción levantada: 3 días sin continuación',
|
||||
'messages.outcome.deadline.typo': 'corrección aplicada: 3 días sin respuesta',
|
||||
'messages.outcome.withdrawn': 'propuesta retirada',
|
||||
'messages.outcome.applied': 'corrección aplicada',
|
||||
'messages.outcome.refused': 'corrección rechazada',
|
||||
'messages.outcome.stale': 'corrección caducada: el texto cambió',
|
||||
'messages.outcome.done': 'tratado',
|
||||
|
||||
'propose.mode.replace': 'Modificar este texto',
|
||||
'propose.mode.remove': 'Retirar este artículo',
|
||||
@@ -490,7 +605,7 @@ export const es: Messages = {
|
||||
'error.internal': 'Algo ha fallado por nuestra parte. Inténtalo de nuevo en un momento.',
|
||||
'error.title': 'El título está vacío o es demasiado largo (120 caracteres como máximo).',
|
||||
'error.body': 'El texto está vacío o es demasiado largo (4000 caracteres como máximo).',
|
||||
'error.reason': 'Di en pocas palabras en qué se contradicen estos textos (de 10 a 600 caracteres).',
|
||||
'error.reason': 'Di en pocas palabras en qué se basa tu objeción (de 10 a 600 caracteres).',
|
||||
'error.substantive_not_author': 'Este cambio afecta al sentido: solo el autor de la propuesta puede hacerlo. Propón tu propia versión.',
|
||||
'error.substantive_in_force': 'Este cambio afecta al sentido: proponlo como modificación.',
|
||||
'error.same_unit': 'Estos dos textos se refieren al mismo artículo: de todos modos no pueden estar en vigor a la vez.',
|
||||
@@ -509,7 +624,7 @@ export const es: Messages = {
|
||||
'error.chain_vote_off': 'La votación por la cadena Ğ1 aún no está abierta.',
|
||||
'error.chain_only': 'Aquí, el voto pasa por la cadena Ğ1, con tu monedero.',
|
||||
'error.server_vote': 'Aquí se vota directamente, sin monedero.',
|
||||
'error.too_many_ballots': 'Ya tienes muchos votos esperando a la cadena Ğ1: espera a que se confirmen.',
|
||||
'error.too_many_ballots': 'Ya tienes muchas papeletas esperando, o abandonadas en la última hora: espera a que se confirmen, o vuelve a intentarlo un poco más tarde.',
|
||||
'error.lines': 'Este voto ya no vale: recarga la página y vuelve a empezar.',
|
||||
'error.choice': 'Esta elección no existe.',
|
||||
'error.author': 'Esta cuenta no es una dirección Ğ1.',
|
||||
@@ -523,6 +638,15 @@ export const es: Messages = {
|
||||
'error.not_a_title': 'Este módulo no es el título del documento.',
|
||||
'error.same_title': 'Ya es el título en vigor.',
|
||||
'error.section': 'Esta sección no existe en este documento.',
|
||||
'error.objection': 'Una objeción retiene esta versión: no se vota hasta que se levante.',
|
||||
'error.kind': 'Di si este texto repite el otro o lo contradice.',
|
||||
'error.other': 'Elige otro artículo, en vigor o propuesto.',
|
||||
'error.both_in_force': 'Los dos textos están en vigor: una objeción siempre apunta a una versión que aún no lo está.',
|
||||
'error.objection_exists': 'Ya tienes una objeción en curso sobre estos dos textos.',
|
||||
'error.nothing_to_reiterate': 'Nada que reiterar: aún no ha llegado ninguna respuesta.',
|
||||
'error.lifted': 'Esta objeción ya está levantada.',
|
||||
'error.settled': 'Esta corrección ya está decidida.',
|
||||
'error.link': 'Esta propuesta no puede responder a esta objeción: apunta a otro artículo, o la objeción está levantada.',
|
||||
'error.retry': 'Reintentar',
|
||||
|
||||
'common.cancel': 'Cancelar',
|
||||
|
||||
+143
-19
@@ -14,6 +14,9 @@ export const fr = {
|
||||
'nav.mandates': 'Mandats',
|
||||
'nav.protocols': 'Protocoles',
|
||||
'nav.groups': 'Mes groupes',
|
||||
'nav.messages': 'Messages',
|
||||
'nav.messages.count.one': 'Messages, {n} non lu',
|
||||
'nav.messages.count.other': 'Messages, {n} non lus',
|
||||
'nav.docs.count.one': '{label}, {n} doc en cours',
|
||||
'nav.docs.count.other': '{label}, {n} docs en cours',
|
||||
'nav.access': 'Accès',
|
||||
@@ -142,7 +145,7 @@ export const fr = {
|
||||
'deep.addition': 'nouvel article',
|
||||
'deep.removal': 'retrait de « {title} »',
|
||||
'deep.inertia': 'inertie vers {level}',
|
||||
'deep.blocked': 'bloquée',
|
||||
'deep.held': 'non votable : objection',
|
||||
'deep.mine': 'ta proposition',
|
||||
'deep.stale': 'à reconfirmer',
|
||||
'deep.wellrated': 'bien cotée',
|
||||
@@ -231,7 +234,14 @@ export const fr = {
|
||||
'vote.stale': "Le texte a changé de fond depuis ton vote : ton vote ne compte plus tant que tu ne l'as pas reconfirmé.",
|
||||
'vote.reconfirm': 'Reconfirmer : {choice}',
|
||||
'vote.private': 'Ton vote ne se montre à personne : seuls les totaux sont visibles.',
|
||||
'vote.blocked': "Un signalement de contradiction la retient : elle ne peut pas entrer en vigueur tant qu'il tient.",
|
||||
'vote.held': "Une objection retient cette version : elle ne se vote plus jusqu'à sa levée. Les votes déjà faits restent.",
|
||||
'vote.held.redit': 'Elle redit « {other} ».',
|
||||
'vote.held.contredit': 'Elle contredit « {other} ».',
|
||||
'vote.held.author.redit': "Pour qu'elle se vote à nouveau, modifie l'article visé. La personne qui a fait l'objection la lève alors, ou la réitère ; sans réponse de sa part sous 3 jours, elle est levée.",
|
||||
'vote.held.author.contredit': "Pour qu'elle se vote à nouveau, reformule-la. La personne qui a fait l'objection la lève alors, ou la réitère ; sans réponse de sa part sous 3 jours, elle est levée.",
|
||||
'vote.held.waiting': "Une réponse est arrivée : {name} lève ou réitère l'objection d'ici le {date} ; sans réponse, elle est levée.",
|
||||
'vote.held.mine': 'Tu as fait cette objection : lève-la quand la réponse te convient.',
|
||||
'vote.held.mine.asked': "Une réponse est arrivée : lève ton objection si elle te convient, ou réitère-la, d'ici le {date}. Sans réponse de ta part, elle est levée.",
|
||||
'vote.entered': '« {title} » est entré en vigueur.',
|
||||
'vote.entered.remove': '« {title} » est retiré du texte en vigueur.',
|
||||
'vote.entered.inertia': "L'inertie de « {title} » a changé.",
|
||||
@@ -247,14 +257,15 @@ export const fr = {
|
||||
'vote.mine.pending': 'En attente de la chaîne Ğ1 : {choice}.',
|
||||
'vote.mine.refused': "Ton dernier vote n'a pas été compté : {reason}",
|
||||
'vote.mine.expired': "Ton dernier vote n'a pas été vu sur la chaîne Ğ1 à temps : il ne compte pas.",
|
||||
'vote.mine.receipts': 'Tes bulletins et reçus',
|
||||
'vote.choice.for': 'pour',
|
||||
'vote.choice.against': 'contre',
|
||||
'vote.choice.none': 'retrait de ton vote',
|
||||
'vote.chain.note': 'Ton vote part de ton portefeuille Ğ1 : {amount} Ğ1, en un seul geste. La chaîne montre que tu as voté, jamais ce que tu as voté.',
|
||||
'vote.chain.counts': "Ta voix compte pour l'identité Ğ1 du portefeuille qui signe, si elle est membre de la toile de confiance.",
|
||||
'vote.chain.off': "Le vote par la chaîne Ğ1 n'est pas encore ouvert : le compte qui reçoit les votes reste à créer. Tu peux lire, proposer et signaler une contradiction.",
|
||||
'vote.chain.off': "Le vote par la chaîne Ğ1 n'est pas encore ouvert : le compte qui reçoit les votes reste à créer. Tu peux lire, proposer et faire une objection.",
|
||||
'vote.members': 'Seuls les membres de ce groupe votent ici.',
|
||||
'vote.details': 'Coquilles, traductions, signalements, historique',
|
||||
'vote.details': 'Coquilles, traductions, objections, historique',
|
||||
'ballot.reason.not_member': "le portefeuille qui a signé n'est pas celui d'un membre de la toile de confiance Ğ1.",
|
||||
'ballot.reason.no_identity': "le portefeuille qui a signé n'est rattaché à aucune identité Ğ1.",
|
||||
'ballot.reason.transfer': 'le virement vers le compte des votes manque, ou son montant est trop faible.',
|
||||
@@ -281,6 +292,7 @@ export const fr = {
|
||||
'basket.sent.other': '{n} votes enregistrés.',
|
||||
'basket.section': 'Voter cette section',
|
||||
'basket.mine': 'ton vote : {choice}',
|
||||
'basket.held': 'non votable : une objection la retient',
|
||||
'sign.title': 'Voter avec ton portefeuille Ğ1',
|
||||
'sign.summary.one': '{n} vote, en une transaction : {amount} Ğ1 vers le compte des votes, avec ton bulletin scellé.',
|
||||
'sign.summary.other': '{n} votes, en une transaction : {amount} Ğ1 vers le compte des votes, avec ton bulletin scellé.',
|
||||
@@ -308,6 +320,38 @@ export const fr = {
|
||||
'sign.close': 'Fermer',
|
||||
'sign.later': "Tu peux fermer : la confirmation arrivera seule, et ton vote apparaîtra sous l'article.",
|
||||
'sign.retry': 'Réessayer',
|
||||
'sign.error.chain': "La chaîne Ğ1 a refusé la transaction : ton vote n'est pas parti. Réessaie quand tu veux.",
|
||||
'sign.receipt': 'Télécharger ton reçu',
|
||||
'sign.history': 'Tes bulletins',
|
||||
'sign.receipt.note': 'Ton reçu garde ton bulletin et son sel : avec lui, tu vérifies toi-même que la chaîne porte ton vote. Garde-le pour toi.',
|
||||
|
||||
'ballots.title': 'Tes bulletins de vote',
|
||||
'ballots.intro': "Chaque vote par la chaîne Ğ1 part dans un bulletin scellé : la chaîne montre que tu as voté, jamais ce que tu as voté. Ton reçu garde le bulletin et son sel ; avec lui, tu vérifies toi-même ton vote. Personne d'autre ne le reçoit.",
|
||||
'ballots.mine': 'Tes bulletins',
|
||||
'ballots.signin': 'Connecte-toi pour retrouver tes bulletins.',
|
||||
'ballots.none': "Tu n'as encore envoyé aucun bulletin par la chaîne Ğ1.",
|
||||
'ballots.lines.one': '{n} vote',
|
||||
'ballots.lines.other': '{n} votes',
|
||||
'ballots.status.pending': 'En attente de la chaîne Ğ1',
|
||||
'ballots.status.confirmed': "Compté pour l'identité Ğ1 « {name} »",
|
||||
'ballots.status.refused': 'Pas compté : {reason}',
|
||||
'ballots.status.expired': 'Pas vu sur la chaîne Ğ1 à temps : il ne compte pas',
|
||||
'ballots.block': 'bloc {n}',
|
||||
'ballots.receipt': 'Télécharger le reçu',
|
||||
'ballots.verify.title': 'Vérifier un reçu',
|
||||
'ballots.verify.intro': "Choisis le fichier d'un reçu, ou colle son contenu : la page recalcule l'empreinte du bulletin ici même, sans rien demander au serveur.",
|
||||
'ballots.verify.file': 'Fichier du reçu',
|
||||
'ballots.verify.paste': 'Ou colle le reçu',
|
||||
'ballots.verify.go': 'Vérifier',
|
||||
'ballots.verify.ok': 'Le reçu tient : ses votes et son sel donnent bien ce commentaire.',
|
||||
'ballots.verify.line': 'Version {version}, révision {revision} : {choice}',
|
||||
'ballots.verify.line.label': '{label} — noté dans le reçu, hors du sceau',
|
||||
'ballots.verify.where': "Cherche ce commentaire dans l'historique de ton portefeuille : c'est ton vote, inscrit sur la chaîne Ğ1.",
|
||||
'ballots.verify.where.block': "Cherche ce commentaire dans l'historique de ton portefeuille, ou sur la chaîne Ğ1 (le reçu indique le bloc {block}, hors du sceau) : s'il y figure, signé de ton compte, c'est ton vote.",
|
||||
'ballots.verify.bad': 'Le reçu ne tient pas : ses votes et son sel ne donnent pas son commentaire.',
|
||||
'ballots.verify.computed': 'Recalculé :',
|
||||
'ballots.verify.expected': 'Dans le reçu :',
|
||||
'ballots.verify.unreadable': "Ce n'est pas un reçu de vote lisible.",
|
||||
|
||||
'inertia.title': 'Inertie',
|
||||
'inertia.explain': "Plus l'inertie est haute, plus il faut de voix pour changer ce texte quand peu de gens votent.",
|
||||
@@ -362,27 +406,98 @@ export const fr = {
|
||||
'history.typo': 'coquille corrigée',
|
||||
'history.substantive': 'changement de fond (votes à reconfirmer)',
|
||||
'history.amendment': 'texte de départ remplacé',
|
||||
'history.revert': "correction retirée par l'auteur",
|
||||
'history.by': 'par {name}',
|
||||
'history.typo.validated': 'validée par {name}',
|
||||
'history.typo.deadline': 'appliquée sans réponse sous 3 jours',
|
||||
|
||||
'typo.title': 'Corriger une coquille',
|
||||
'typo.note': "Accents, majuscules, faute de frappe, mot collé ou coupé : la correction s'applique sans vote, avec son auteur et son diff. La ponctuation, les chiffres, les formules, les adresses et tout changement de sens passent par une proposition.",
|
||||
'typo.note': "Accents, majuscules, faute de frappe, mot collé ou coupé : la correction ne se vote pas. Sur ton texte, elle s'applique tout de suite. Sur celui d'une autre personne, son auteur la valide (un administrateur pour un texte du seed) ; sans réponse sous 3 jours, elle s'applique. La ponctuation, les chiffres, les formules, les adresses et tout changement de sens passent par une proposition.",
|
||||
'typo.save': 'Enregistrer la correction',
|
||||
'typo.done': 'Coquille corrigée, sans toucher aux votes.',
|
||||
'typo.substantive': 'Ce changement touche au sens : propose-le comme modification.',
|
||||
'typo.asProposal': 'En faire une proposition',
|
||||
'typo.pending.author': "Ta correction attend l'auteur du texte : elle s'applique quand il la valide, ou d'elle-même le {date}.",
|
||||
'typo.pending.admin': "Ta correction attend un administrateur, ce texte venant du seed : elle s'applique quand il la valide, ou d'elle-même le {date}.",
|
||||
'typo.list': 'Coquilles proposées',
|
||||
'typo.by': 'proposée par {name}',
|
||||
'typo.status.pending': "en attente : s'applique d'elle-même le {date}",
|
||||
'typo.status.applied': 'appliquée',
|
||||
'typo.status.refused': 'refusée',
|
||||
'typo.status.stale': 'périmée : le texte a changé entre-temps',
|
||||
'typo.settled.by': 'par {name}',
|
||||
'typo.settled.deadline': 'sans réponse sous 3 jours',
|
||||
'typo.validate': 'Valider',
|
||||
'typo.refuse': 'Refuser',
|
||||
'typo.undo': "Revenir au texte d'avant",
|
||||
'typo.redo': 'Appliquer finalement',
|
||||
'typo.validated': 'Correction appliquée.',
|
||||
'typo.refused': 'Correction refusée.',
|
||||
|
||||
'signal.title': 'Contradictions',
|
||||
'signal.none': 'Aucun signalement.',
|
||||
'signal.add': 'Signaler une contradiction',
|
||||
'signal.target': 'Contredit',
|
||||
'signal.reason': 'En quoi ces deux textes se contredisent',
|
||||
'signal.send': 'Signaler',
|
||||
'signal.sent': 'Signalement enregistré.',
|
||||
'signal.note': "Tant qu'un signalement tient, ces deux textes ne peuvent pas être en vigueur ensemble. Son auteur le lève ; un changement de fond le fait tomber.",
|
||||
'signal.lift': 'Lever',
|
||||
'signal.lifted': 'levé',
|
||||
'signal.lifted.revision': 'tombé : le texte a changé',
|
||||
'signal.by': 'par {name}',
|
||||
'objection.title': 'Objections',
|
||||
'objection.none': 'Aucune objection.',
|
||||
'objection.add': 'Faire une objection',
|
||||
'objection.kind': 'Ton objection',
|
||||
'objection.kind.redit': 'Redit',
|
||||
'objection.kind.contredit': 'Contredit',
|
||||
'objection.kind.redit.hint': 'ce texte répète un autre article',
|
||||
'objection.kind.contredit.hint': "ce texte dit le contraire d'un autre article",
|
||||
'objection.target': 'Quel article ?',
|
||||
'objection.reason.redit': 'En quoi ces deux textes disent la même chose',
|
||||
'objection.reason.contredit': 'En quoi ces deux textes se contredisent',
|
||||
'objection.send': "Envoyer l'objection",
|
||||
'objection.sent': "Objection enregistrée : la dernière arrivée des deux versions ne se vote plus jusqu'à sa levée.",
|
||||
'objection.note': "Une objection rend la dernière arrivée des deux versions non votable jusqu'à sa levée — jamais un texte en vigueur. Son auteur répond : pour une redite, il modifie l'article visé ; pour une contradiction, il reformule. Tu lèves alors l'objection ou tu la réitères ; sans réponse de ta part sous 3 jours, elle est levée.",
|
||||
'objection.says.redit': '« {held} » redit « {other} »',
|
||||
'objection.says.contredit': '« {held} » contredit « {other} »',
|
||||
'objection.by': 'objection de {name}',
|
||||
'objection.held.here': 'cette version ne se vote plus',
|
||||
'objection.phase.author': "en attente d'une réponse de l'auteur",
|
||||
'objection.phase.objector': "réponse arrivée : levée ou réitérée d'ici le {date}, sinon levée d'elle-même",
|
||||
'objection.answer.revision': 'réponse : le texte retenu a été reformulé',
|
||||
'objection.answer.other': "réponse : l'autre texte a changé",
|
||||
'objection.answer.proposal': 'réponse : une proposition liée',
|
||||
'objection.lifted.objector': "levée par la personne qui l'a faite",
|
||||
'objection.lifted.admin': 'levée par un administrateur',
|
||||
'objection.lifted.deadline': 'levée : 3 jours sans suite',
|
||||
'objection.lifted.withdrawn': 'levée : la proposition a été retirée',
|
||||
'objection.lifted.revision': 'tombée : le texte a changé',
|
||||
'objection.lift': "Lever l'objection",
|
||||
'objection.lift.admin': "Lever l'objection (administrateur)",
|
||||
'objection.reiterate': "Réitérer l'objection",
|
||||
'objection.done.lifted': 'Objection levée.',
|
||||
'objection.done.reiterated': 'Objection réitérée : une nouvelle réponse est attendue.',
|
||||
'objection.respond.redit': "Modifier l'article visé",
|
||||
'objection.respond.contredit': 'Reformuler',
|
||||
'objection.linked': "Cette proposition répond à une objection : une fois soumise, la personne qui l'a faite la lève ou la réitère.",
|
||||
'messages.title': 'Messages',
|
||||
'messages.intro': 'Ce qui attend un geste de toi : une objection à laquelle répondre, une correction de coquille à valider. Chaque message porte son échéance ; un message traité ne demande plus rien.',
|
||||
'messages.none': "Aucun message pour l'instant.",
|
||||
'messages.readAll': 'Tout marquer comme lu',
|
||||
'messages.read': 'Marquer comme lu',
|
||||
'messages.unread': 'non lu',
|
||||
'messages.due': 'échéance : {date}',
|
||||
'messages.open': 'Voir dans le texte',
|
||||
'messages.topic.objection': 'Objection',
|
||||
'messages.topic.typo': 'Coquille',
|
||||
'messages.objection_raised.redit': "{name} fait une objection : ta version « {held} » redit « {other} ». Elle ne se vote plus jusqu'à sa levée. Pour répondre, modifie l'article visé.",
|
||||
'messages.objection_raised.contredit': "{name} fait une objection : ta version « {held} » contredit « {other} ». Elle ne se vote plus jusqu'à sa levée. Pour répondre, reformule-la.",
|
||||
'messages.objection_reiterated': '{name} réitère son objection : « {held} » ne se vote toujours pas. Réponds à nouveau.',
|
||||
'messages.objection_answered': 'Ton objection sur « {held} » a reçu une réponse. Lève-la si elle te convient, ou réitère-la. Sans réponse de ta part, elle est levée.',
|
||||
'messages.typo_pending.author': '{name} propose une correction de coquille dans ta version « {title} ».',
|
||||
'messages.typo_pending.admin': '{name} propose une correction de coquille dans « {title} », un texte du seed : un administrateur la valide.',
|
||||
'messages.respond': 'Répondre',
|
||||
'messages.outcome.answered': 'réponse donnée',
|
||||
'messages.outcome.reiterated': 'objection réitérée',
|
||||
'messages.outcome.lifted': 'objection levée',
|
||||
'messages.outcome.admin': 'objection levée par un administrateur',
|
||||
'messages.outcome.deadline.objection': 'objection levée : 3 jours sans suite',
|
||||
'messages.outcome.deadline.typo': 'correction appliquée : 3 jours sans réponse',
|
||||
'messages.outcome.withdrawn': 'proposition retirée',
|
||||
'messages.outcome.applied': 'correction appliquée',
|
||||
'messages.outcome.refused': 'correction refusée',
|
||||
'messages.outcome.stale': 'correction périmée : le texte a changé',
|
||||
'messages.outcome.done': 'traité',
|
||||
|
||||
'propose.mode.replace': 'Modifier ce texte',
|
||||
'propose.mode.remove': 'Retirer cet article',
|
||||
@@ -493,7 +608,7 @@ export const fr = {
|
||||
'error.internal': 'Quelque chose a échoué de notre côté. Réessaie dans un moment.',
|
||||
'error.title': 'Le titre est vide ou trop long (120 signes au plus).',
|
||||
'error.body': 'Le texte est vide ou trop long (4 000 signes au plus).',
|
||||
'error.reason': 'Dis en quelques mots en quoi ces textes se contredisent (10 à 600 signes).',
|
||||
'error.reason': 'Dis en quelques mots ce qui fonde ton objection (10 à 600 signes).',
|
||||
'error.substantive_not_author': "Ce changement touche au sens : seul l'auteur de la proposition peut le faire. Propose ta propre version.",
|
||||
'error.substantive_in_force': 'Ce changement touche au sens : propose-le comme modification.',
|
||||
'error.same_unit': "Ces deux textes visent le même article : ils ne peuvent de toute façon pas être en vigueur ensemble.",
|
||||
@@ -512,7 +627,7 @@ export const fr = {
|
||||
'error.chain_vote_off': "Le vote par la chaîne Ğ1 n'est pas encore ouvert.",
|
||||
'error.chain_only': 'Ici, le vote passe par la chaîne Ğ1, avec ton portefeuille.',
|
||||
'error.server_vote': 'Ici, le vote se fait directement, sans portefeuille.',
|
||||
'error.too_many_ballots': 'Tu as déjà beaucoup de votes en attente de la chaîne Ğ1 : attends leur confirmation.',
|
||||
'error.too_many_ballots': 'Tu as déjà beaucoup de bulletins en attente, ou laissés en route depuis une heure : attends leur confirmation, ou réessaie un peu plus tard.',
|
||||
'error.lines': 'Ce vote ne tient plus : recharge la page, puis recommence.',
|
||||
'error.choice': "Ce choix n'existe pas.",
|
||||
'error.author': "Ce compte n'est pas une adresse Ğ1.",
|
||||
@@ -526,6 +641,15 @@ export const fr = {
|
||||
'error.not_a_title': "Ce module n'est pas le titre du document.",
|
||||
'error.same_title': "C'est déjà le titre en vigueur.",
|
||||
'error.section': "Cette section n'existe pas dans ce document.",
|
||||
'error.objection': "Une objection retient cette version : elle ne se vote plus jusqu'à sa levée.",
|
||||
'error.kind': "Dis si ce texte redit l'autre ou le contredit.",
|
||||
'error.other': 'Choisis un autre article, en vigueur ou proposé.',
|
||||
'error.both_in_force': 'Ces deux textes sont en vigueur : une objection vise toujours une version qui ne l’est pas encore.',
|
||||
'error.objection_exists': 'Tu as déjà une objection en cours sur ces deux textes.',
|
||||
'error.nothing_to_reiterate': "Rien à réitérer : aucune réponse n'est encore arrivée.",
|
||||
'error.lifted': 'Cette objection est déjà levée.',
|
||||
'error.settled': 'Cette correction est déjà tranchée.',
|
||||
'error.link': 'Cette proposition ne peut pas répondre à cette objection : elle vise un autre article, ou l’objection est levée.',
|
||||
'error.retry': 'Réessayer',
|
||||
|
||||
'common.cancel': 'Annuler',
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// Answering an objection (Yvv, 2026-10-30: « Pour ce qui constitue une
|
||||
// répétition → modifier l'article cible ; pour une contradiction →
|
||||
// reformuler »): where the author of the version held back is taken.
|
||||
|
||||
import type { PanelState } from './doc.svelte';
|
||||
import type { Objection } from './types';
|
||||
|
||||
/**
|
||||
* A repetition: a proposal that changes the article repeated, linked to the
|
||||
* objection, starting from its text. A contradiction: one's own open version is
|
||||
* reworded in place; a seeded one, by a linked proposal on its article.
|
||||
*/
|
||||
export function answerPanel(o: Objection, me: string | null): PanelState | null {
|
||||
const held = o.heldVersion;
|
||||
if (!held) return null;
|
||||
if (o.kind === 'redit') {
|
||||
return { tab: 'propose', unitId: o.other.unitId, proposalId: o.other.id, objectionId: o.id };
|
||||
}
|
||||
if (me && held.authorId === me && held.status === 'open') {
|
||||
return { tab: 'details', unitId: held.unitId, proposalId: held.id, edit: true };
|
||||
}
|
||||
return { tab: 'propose', unitId: held.unitId, proposalId: held.id, objectionId: o.id };
|
||||
}
|
||||
|
||||
/** The objections standing against a version, held back by them. */
|
||||
export function holding(objections: Objection[]): Objection[] {
|
||||
return objections.filter((o) => o.held && o.phase !== 'lifted');
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// The receipt of a vote on the Ğ1 chain (ADR 0008): the ballot itself — its
|
||||
// lines and its salt — as the person who asked for it downloads it
|
||||
// (`GET /api/ballots/{id}/receipt`). Checked here, in the browser, without asking
|
||||
// the server anything: the canonical text, its blake2b-256 seal, and the comment
|
||||
// `ld1:` + seal that the chain carries. The same rules as the engine
|
||||
// (crates/ld-engine/src/ballot.rs, `canonical` and `seal`).
|
||||
|
||||
import { blake2b } from '@noble/hashes/blake2.js';
|
||||
|
||||
export type ReceiptChoice = 'for' | 'against' | 'none';
|
||||
|
||||
export interface ReceiptLine {
|
||||
proposalId: string;
|
||||
revision: number;
|
||||
choice: ReceiptChoice;
|
||||
/** For reading only: the article and the title of the version voted. */
|
||||
article?: string;
|
||||
title?: string | null;
|
||||
}
|
||||
|
||||
export interface Sealed {
|
||||
canonical: string;
|
||||
digest: string;
|
||||
comment: string;
|
||||
/** What the indexer finds the comment by: `0x` + blake2b-256 of the comment. */
|
||||
remarkHash: string;
|
||||
}
|
||||
|
||||
export type ReceiptCheck =
|
||||
| { kind: 'unreadable' }
|
||||
| { kind: 'ok'; comment: string; remarkHash: string; block: number | null; lines: ReceiptLine[] }
|
||||
| { kind: 'mismatch'; comment: string; computed: string };
|
||||
|
||||
const CHOICES: readonly string[] = ['for', 'against', 'none'];
|
||||
/** Printable ASCII without spaces: what reads back, one field per line. */
|
||||
const PLAIN = /^[\x21-\x7e]+$/;
|
||||
const SALT = /^[0-9a-f]{32}$/;
|
||||
|
||||
const hex = (bytes: Uint8Array) => Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
|
||||
|
||||
export function blake2_256(text: string): string {
|
||||
return hex(blake2b(new TextEncoder().encode(text), { dkLen: 32 }));
|
||||
}
|
||||
|
||||
/** The ballot as it is hashed; `null` if it cannot be one. */
|
||||
export function canonical(doc: string, author: string | null, lines: ReceiptLine[], salt: string): string | null {
|
||||
if (!PLAIN.test(doc) || (author !== null && !PLAIN.test(author)) || !SALT.test(salt)) return null;
|
||||
const sorted = [...lines].sort((a, b) => (a.proposalId < b.proposalId ? -1 : a.proposalId > b.proposalId ? 1 : 0));
|
||||
if (!sorted.length) return null;
|
||||
for (const [i, l] of sorted.entries()) {
|
||||
if (!PLAIN.test(l.proposalId) || (i > 0 && sorted[i - 1]?.proposalId === l.proposalId)) return null;
|
||||
if (!Number.isInteger(l.revision) || l.revision < 0 || l.revision > 0xffff_ffff || !CHOICES.includes(l.choice)) return null;
|
||||
}
|
||||
let out = `ld1\ndoc ${doc}\nauthor ${author ?? '-'}\n`;
|
||||
for (const l of sorted) out += `line ${l.proposalId} ${l.revision} ${l.choice}\n`;
|
||||
return `${out}salt ${salt}\n`;
|
||||
}
|
||||
|
||||
export function seal(doc: string, author: string | null, lines: ReceiptLine[], salt: string): Sealed | null {
|
||||
const text = canonical(doc, author, lines, salt);
|
||||
if (text === null) return null;
|
||||
const digest = blake2_256(text);
|
||||
const comment = `ld1:${digest}`;
|
||||
return { canonical: text, digest, comment, remarkHash: `0x${blake2_256(comment)}` };
|
||||
}
|
||||
|
||||
const isLine = (l: unknown): l is ReceiptLine => {
|
||||
const v = l as Partial<ReceiptLine> | null;
|
||||
return !!v && typeof v.proposalId === 'string' && typeof v.revision === 'number' && typeof v.choice === 'string';
|
||||
};
|
||||
|
||||
/** Reads a receipt (its text, as downloaded) and recomputes its seal. */
|
||||
export function checkReceipt(text: string): ReceiptCheck {
|
||||
let raw: unknown;
|
||||
try {
|
||||
raw = JSON.parse(text);
|
||||
} catch {
|
||||
return { kind: 'unreadable' };
|
||||
}
|
||||
const r = raw as Record<string, unknown> | null;
|
||||
if (!r || typeof r !== 'object' || Array.isArray(r) || r.format !== 'ld1') return { kind: 'unreadable' };
|
||||
const { doc, author, lines, salt, comment, block } = r;
|
||||
if (typeof doc !== 'string' || typeof salt !== 'string' || typeof comment !== 'string') return { kind: 'unreadable' };
|
||||
if (author !== null && typeof author !== 'string') return { kind: 'unreadable' };
|
||||
if (!Array.isArray(lines) || !lines.every(isLine)) return { kind: 'unreadable' };
|
||||
const s = seal(doc, author, lines, salt);
|
||||
if (!s) return { kind: 'unreadable' };
|
||||
if (s.comment !== comment) return { kind: 'mismatch', comment, computed: s.comment };
|
||||
return { kind: 'ok', comment, remarkHash: s.remarkHash, block: typeof block === 'number' ? block : null, lines };
|
||||
}
|
||||
@@ -1,11 +1,17 @@
|
||||
import { api } from './api';
|
||||
import type { Me } from './types';
|
||||
|
||||
/** How often the number of unread messages is looked at again, while signed in. */
|
||||
const UNREAD_EVERY_MS = 60_000;
|
||||
|
||||
class Session {
|
||||
me = $state<Me | null>(null);
|
||||
ready = $state(false);
|
||||
g1 = $state(false);
|
||||
dev = $state(false);
|
||||
/** Unread messages of one's box, next to « Messages » in the menu (ADR 0010). */
|
||||
unread = $state(0);
|
||||
#timer: ReturnType<typeof setInterval> | undefined;
|
||||
|
||||
async load() {
|
||||
const [me, cfg] = await Promise.all([
|
||||
@@ -16,11 +22,33 @@ class Session {
|
||||
this.g1 = cfg.g1;
|
||||
this.dev = cfg.dev;
|
||||
this.ready = true;
|
||||
this.watch();
|
||||
}
|
||||
|
||||
/** Looks at the box again: on a navigation, after a gesture, every minute. */
|
||||
async refreshUnread() {
|
||||
if (!this.me) {
|
||||
this.unread = 0;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.unread = (await api.get<{ unread: number }>('/messages/unread')).unread;
|
||||
} catch {
|
||||
/* the count waits for the next look */
|
||||
}
|
||||
}
|
||||
|
||||
/** A sign-in on another page sets `me` directly: the count follows on the next look. */
|
||||
private watch() {
|
||||
clearInterval(this.#timer);
|
||||
void this.refreshUnread();
|
||||
this.#timer = setInterval(() => void this.refreshUnread(), UNREAD_EVERY_MS);
|
||||
}
|
||||
|
||||
async logout() {
|
||||
await api.post('/auth/logout');
|
||||
this.me = null;
|
||||
this.unread = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+99
-1
@@ -110,8 +110,12 @@ export interface Proposal {
|
||||
tally: Tally;
|
||||
evaluation: Evaluation | null;
|
||||
votedAtInertia: Inertia;
|
||||
/** Held back by a standing objection: the latest arrival of the two (never a text in force). */
|
||||
blocked: boolean;
|
||||
signals: number;
|
||||
/** May be voted now: open or in force, and not held back (ADR 0010). */
|
||||
votable: boolean;
|
||||
/** Standing objections around this version. */
|
||||
objections: number;
|
||||
myVote: 'for' | 'against' | null;
|
||||
myVoteStale: boolean;
|
||||
/** « Ton vote » was cast on the Ğ1 chain (confirmed). */
|
||||
@@ -169,6 +173,20 @@ export interface Ballot {
|
||||
expiresAt: string;
|
||||
}
|
||||
|
||||
/** A ballot of the person's history (`GET /api/ballots`): never anyone else's. */
|
||||
export interface BallotEntry {
|
||||
id: string;
|
||||
doc: { id: string; group: string; slug: string; title: LangMap | string };
|
||||
comment: string;
|
||||
status: Ballot['status'];
|
||||
reason: Ballot['reason'];
|
||||
block: number | null;
|
||||
voter: string | null;
|
||||
lines: number;
|
||||
createdAt: string;
|
||||
settledAt: string | null;
|
||||
}
|
||||
|
||||
export interface Unit {
|
||||
id: string;
|
||||
code: string;
|
||||
@@ -244,3 +262,83 @@ export interface Entered {
|
||||
code: string;
|
||||
kind: 'text' | 'remove' | 'inertia' | 'title' | 'order';
|
||||
}
|
||||
|
||||
export type ObjectionKind = 'redit' | 'contredit';
|
||||
|
||||
/** A version as an objection names it. */
|
||||
export interface VersionRef {
|
||||
id: string;
|
||||
title: string | null;
|
||||
status: Proposal['status'] | null;
|
||||
unitId: string | null;
|
||||
code: string | null;
|
||||
author: string | null;
|
||||
authorId: string | null;
|
||||
}
|
||||
|
||||
/** An objection, as the session sees it (ADR 0010). */
|
||||
export interface Objection {
|
||||
id: string;
|
||||
kind: ObjectionKind;
|
||||
reason: string;
|
||||
objector: string | null;
|
||||
objectorInvited: boolean;
|
||||
/** This session raised it. */
|
||||
mine: boolean;
|
||||
at: string;
|
||||
/** The author answers, then the objector lifts or reiterates; or it is lifted. */
|
||||
phase: 'author' | 'objector' | 'lifted';
|
||||
cycle: number;
|
||||
/** While the objector is asked: past this, it is lifted. */
|
||||
dueAt: string | null;
|
||||
answer: 'revision' | 'other' | 'proposal' | null;
|
||||
answerId: string | null;
|
||||
answeredAt: string | null;
|
||||
lift: 'objector' | 'admin' | 'deadline' | 'withdrawn' | 'revision' | null;
|
||||
liftedAt: string | null;
|
||||
/** The latest arrival of the two, not votable while it stands. */
|
||||
heldVersion: VersionRef | null;
|
||||
other: VersionRef;
|
||||
/** This session may answer by a proposal linked to it (the author of the held version, or anyone for a seeded one). */
|
||||
iAnswer: boolean;
|
||||
canLift: boolean;
|
||||
canReiterate: boolean;
|
||||
/** Around one version: whether that version is the one held back. */
|
||||
held?: boolean;
|
||||
}
|
||||
|
||||
/** A typo fix written by someone else than the author (ADR 0010). */
|
||||
export interface TypoFix {
|
||||
id: string;
|
||||
status: 'pending' | 'applied' | 'refused' | 'stale';
|
||||
writer: string | null;
|
||||
writerInvited: boolean;
|
||||
at: string;
|
||||
dueAt: string;
|
||||
settledAt: string | null;
|
||||
/** A name, or `deadline` (passed without an answer), or `changed` (the text moved on). */
|
||||
settledBy: string | null;
|
||||
/** Who answers: the author of the version, or an administrator for a seeded text. */
|
||||
answerer: 'author' | 'admin';
|
||||
diff: DiffPart[];
|
||||
gestures: ('validate' | 'refuse')[];
|
||||
version?: { id: string; title: string; status: Proposal['status']; unitId: string; code: string | null };
|
||||
}
|
||||
|
||||
/** A message of one's box: about an objection or a typo fix, with its gestures now. */
|
||||
export interface Message {
|
||||
id: string;
|
||||
topic: 'objection' | 'typo';
|
||||
kind: 'objection_raised' | 'objection_answered' | 'objection_reiterated' | 'typo_pending';
|
||||
cycle: number;
|
||||
createdAt: string;
|
||||
dueAt: string | null;
|
||||
read: boolean;
|
||||
/** Dealt with: no gesture any more. */
|
||||
done: boolean;
|
||||
outcome: string | null;
|
||||
gestures: ('respond' | 'lift' | 'reiterate' | 'validate' | 'refuse')[];
|
||||
doc: { id: string; groupSlug: string; slug: string; title: LangMap };
|
||||
objection?: Objection;
|
||||
typo?: TypoFix;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@ export function level(p: Proposal): number {
|
||||
|
||||
/**
|
||||
* Negative when `a` comes before `b`: the highest water, then more for, then fewer
|
||||
* against. A blocked version comes after the others: it cannot enter into force.
|
||||
* against. A version held back by an objection comes after the others: it is not
|
||||
* votable, and cannot enter into force, until the objection is lifted.
|
||||
*/
|
||||
export function compare(a: Proposal, b: Proposal): number {
|
||||
return (
|
||||
|
||||
@@ -25,9 +25,13 @@ export interface VoteTransfer {
|
||||
remark: string;
|
||||
}
|
||||
|
||||
/** signing: the wallet asks the person; sent: on its way to the chain; included: in a block. */
|
||||
export type SendStatus = 'signing' | 'sent' | 'included';
|
||||
export type Failure = 'cancelled' | 'funds' | 'node' | 'account' | 'wallet';
|
||||
/**
|
||||
* signing: the wallet asks the person; signed: signed and handed to the node —
|
||||
* from now on the transaction may reach the chain; sent: on its way; included: in a block.
|
||||
*/
|
||||
export type SendStatus = 'signing' | 'signed' | 'sent' | 'included';
|
||||
/** chain: included in a block, but the chain undid it (the transfer failed): no vote will come. */
|
||||
export type Failure = 'cancelled' | 'funds' | 'node' | 'account' | 'wallet' | 'chain';
|
||||
|
||||
export class WalletError extends Error {
|
||||
constructor(public code: Failure) {
|
||||
@@ -69,6 +73,12 @@ export function injectedNames(page: Page): string[] {
|
||||
/** What went wrong, in one of a few words the interface translates. */
|
||||
export function failure(e: unknown): Failure {
|
||||
if (e instanceof WalletError) return e.code;
|
||||
// polkadot-api's refusal by the node's pool (stale, bad proof, too late…): never sent.
|
||||
// Its message is indented JSON, so the reason is read from the error itself.
|
||||
if (e instanceof Error && e.name === 'InvalidTxError') {
|
||||
const reason = JSON.stringify((e as Error & { error?: unknown }).error ?? e.message).toLowerCase();
|
||||
return /payment|funds|balance|existential/.test(reason) ? 'funds' : 'chain';
|
||||
}
|
||||
let text: string;
|
||||
if (e instanceof Error) text = e.message;
|
||||
else {
|
||||
@@ -81,14 +91,29 @@ export function failure(e: unknown): Failure {
|
||||
text = text.toLowerCase();
|
||||
if (/cancel|reject|denied|declined/.test(text)) return 'cancelled';
|
||||
if (/payment|funds|balance|existential|pay some fees/.test(text)) return 'funds';
|
||||
// Refused by the node's pool (stale, bad proof…): it will never be included.
|
||||
if (/"type":\s*"invalid"|invalid transaction/.test(text)) return 'chain';
|
||||
return 'wallet';
|
||||
}
|
||||
|
||||
/** The wallet stopped before anything reached the chain, or the chain undid it all: no vote will come. */
|
||||
export function nothingSent(f: Failure): boolean {
|
||||
return f === 'cancelled' || f === 'funds' || f === 'account';
|
||||
return f === 'cancelled' || f === 'funds' || f === 'account' || f === 'chain';
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the page may let a ballot go after a failure: nothing was signed yet
|
||||
* (`left` false — a node down before sending, a refusal, the window closed), or
|
||||
* the chain said no. Otherwise the transaction may still land: the ballot is
|
||||
* kept, and the server reads the indexer for it until its end.
|
||||
*/
|
||||
export function mayLetGo(f: Failure, left: boolean): boolean {
|
||||
return !left || nothingSent(f);
|
||||
}
|
||||
|
||||
/** How long a node may take to answer before the wallet is asked to sign. */
|
||||
const REACH_MS = 20_000;
|
||||
|
||||
const hex = (bytes: Uint8Array) => Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
|
||||
|
||||
/** Tests only: what the fake node receives, readable JSON as hex. Never a real transaction. */
|
||||
@@ -106,10 +131,23 @@ async function enable(name: string): Promise<Enabled> {
|
||||
}
|
||||
}
|
||||
|
||||
/** Tests: one call to the fake node; `null` if it does not answer. */
|
||||
async function rpc(node: string, method: string, params: unknown[] = []): Promise<{ error?: unknown } | null> {
|
||||
const body = { jsonrpc: '2.0', id: 1, method, params };
|
||||
const res = await fetch(node, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }).catch(
|
||||
() => null,
|
||||
);
|
||||
if (!res?.ok) return null;
|
||||
return (await res.json().catch(() => null)) as { error?: unknown } | null;
|
||||
}
|
||||
|
||||
/** Tests: the fake extension signs, the fake node records; no polkadot-api, no chain. */
|
||||
async function sendTest(name: string, node: string, account: WalletAccount, tx: VoteTransfer, on: (s: SendStatus) => void) {
|
||||
const ext = await enable(name);
|
||||
if (!ext.signer.signPayload) throw new WalletError('wallet');
|
||||
// As polkadot-api does, the node is reached before the wallet is asked to sign.
|
||||
const health = await rpc(node, 'system_health');
|
||||
if (!health || health.error) throw new WalletError('node');
|
||||
const fields = { address: account.address, dest: tx.dest, amount: String(tx.amount), remark: tx.remark };
|
||||
on('signing');
|
||||
let signature: string;
|
||||
@@ -118,11 +156,10 @@ async function sendTest(name: string, node: string, account: WalletAccount, tx:
|
||||
} catch (e) {
|
||||
throw new WalletError(failure(e));
|
||||
}
|
||||
const body = { jsonrpc: '2.0', id: 1, method: 'author_submitExtrinsic', params: [testExtrinsic({ ...fields, signature })] };
|
||||
const res = await fetch(node, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }).catch(
|
||||
() => null,
|
||||
);
|
||||
if (!res?.ok) throw new WalletError('node');
|
||||
on('signed');
|
||||
const submitted = await rpc(node, 'author_submitExtrinsic', [testExtrinsic({ ...fields, signature })]);
|
||||
if (!submitted) throw new WalletError('node');
|
||||
if (submitted.error) throw new WalletError(failure(submitted.error));
|
||||
on('sent');
|
||||
}
|
||||
|
||||
@@ -140,6 +177,16 @@ async function sendChain(name: string, nodes: string[], account: WalletAccount,
|
||||
try {
|
||||
const signer = ext.getAccounts().find((a) => a.address === account.address);
|
||||
if (!signer) throw new WalletError('account');
|
||||
// A node must answer before the wallet is asked to sign: otherwise nothing leaves, and the page says so.
|
||||
let wait: ReturnType<typeof setTimeout> | undefined;
|
||||
await Promise.race([
|
||||
client.getFinalizedBlock(),
|
||||
new Promise((_, reject) => (wait = setTimeout(() => reject(new WalletError('node')), REACH_MS))),
|
||||
])
|
||||
.catch(() => {
|
||||
throw new WalletError('node');
|
||||
})
|
||||
.finally(() => clearTimeout(wait));
|
||||
// The calls are read from the chain's own metadata: pallets Utility, Balances and System of Duniter v2.
|
||||
const { tx: calls } = client.getUnsafeApi();
|
||||
const call = calls.Utility!.batch_all!({
|
||||
@@ -153,6 +200,8 @@ async function sendChain(name: string, nodes: string[], account: WalletAccount,
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
const sub = call.createSubmitAndWatch(signer.txCreator).subscribe({
|
||||
next: (ev) => {
|
||||
// Signed: from now on, the transaction may reach the chain.
|
||||
if (ev.type === 'created') on('signed');
|
||||
if (ev.type === 'broadcasted') {
|
||||
on('sent');
|
||||
// Once sent, a block takes 6 seconds: two minutes without one means the node lost it.
|
||||
@@ -167,7 +216,7 @@ async function sendChain(name: string, nodes: string[], account: WalletAccount,
|
||||
if (ev.ok) {
|
||||
on('included');
|
||||
resolve();
|
||||
} else reject(new WalletError(failure(ev.dispatchError)));
|
||||
} else reject(new WalletError(failure(ev.dispatchError) === 'funds' ? 'funds' : 'chain'));
|
||||
}
|
||||
},
|
||||
error: (e: unknown) => {
|
||||
|
||||
Reference in New Issue
Block a user