mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
utils/web: PendingEvent --> EventStub
This commit is contained in:
parent
60cecafdb5
commit
e17111a859
1 changed files with 3 additions and 3 deletions
|
|
@ -7,12 +7,12 @@ import { nostrNow } from '@/utils.ts';
|
||||||
import type { AppContext } from '@/app.ts';
|
import type { AppContext } from '@/app.ts';
|
||||||
|
|
||||||
/** EventTemplate with or without a timestamp. If no timestamp is given, it will be generated. */
|
/** EventTemplate with or without a timestamp. If no timestamp is given, it will be generated. */
|
||||||
interface PendingEvent<K extends number = number> extends Omit<EventTemplate<K>, 'created_at'> {
|
interface EventStub<K extends number = number> extends Omit<EventTemplate<K>, 'created_at'> {
|
||||||
created_at?: number;
|
created_at?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Publish an event through the pipeline. */
|
/** Publish an event through the pipeline. */
|
||||||
async function createEvent<K extends number>(t: PendingEvent<K>, c: AppContext): Promise<Event<K>> {
|
async function createEvent<K extends number>(t: EventStub<K>, c: AppContext): Promise<Event<K>> {
|
||||||
const pubkey = c.get('pubkey');
|
const pubkey = c.get('pubkey');
|
||||||
|
|
||||||
if (!pubkey) {
|
if (!pubkey) {
|
||||||
|
|
@ -28,7 +28,7 @@ async function createEvent<K extends number>(t: PendingEvent<K>, c: AppContext):
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Publish an admin event through the pipeline. */
|
/** Publish an admin event through the pipeline. */
|
||||||
async function createAdminEvent<K extends number>(t: PendingEvent<K>, c: AppContext): Promise<Event<K>> {
|
async function createAdminEvent<K extends number>(t: EventStub<K>, c: AppContext): Promise<Event<K>> {
|
||||||
const event = await signAdminEvent({
|
const event = await signAdminEvent({
|
||||||
created_at: nostrNow(),
|
created_at: nostrNow(),
|
||||||
...t,
|
...t,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue