db/cell_moderation.ts

The cell.moderation read rules, in pure and SQL form side by side.

moderation is null or one of the three markers below: the create authorizer's verdict and cell_moderate write nothing else, and CellJson refuses any other on the wire. Each rule names the markers it admits.

Audience admission — cell_moderation_admits_audience and cell_moderation_admits_audience_sql: unmoderated (null) or 'approved'. A cell's effective audience is its visibility (or grants) and its admission, so the public and grant read arms of can_view_cell require it, as do the editor grant arm of can_edit_cell and the matching arms of query_cell_list (general and shared_with shapes). The owner and global-admin arms don't: an author keeps reading and editing their own pending or rejected contribution, and an admin reads everything.

Stewardship — cell_moderation_is_stewardable and cell_moderation_is_stewardable_sql: exactly 'pending' or 'rejected', the states in which the governing root's manager reads a contribution its audience can't (can_steward_cell).

The pure and SQL forms are written once each here, next to each other, over the same literal constants; every predicate and query composes them rather than restating the rule. Twin of the Rust fuz_cell::cell_moderation.

view source

Declarations
#

7 declarations

cell_moderation_admits_audience
#

db/cell_moderation.ts view source

(moderation: string | null): boolean import {cell_moderation_admits_audience} from '@fuzdev/fuz_app/db/cell_moderation.js';

Whether a cell's moderation marker admits it to an audience beyond its owner — unmoderated (null) or 'approved'; 'pending' and 'rejected' do not.

moderation

the cell's moderation column

type string | null

returns

boolean

whether the public and grant read arms may admit the cell

cell_moderation_admits_audience_sql
#

db/cell_moderation.ts view source

(alias: string): string import {cell_moderation_admits_audience_sql} from '@fuzdev/fuz_app/db/cell_moderation.js';

SQL form of cell_moderation_admits_audience over the cell alias alias (a parenthesized boolean expression).

alias

the cell table alias in the enclosing query

type string

returns

string

the SQL predicate

CELL_MODERATION_APPROVED
#

db/cell_moderation.ts view source

"approved" import {CELL_MODERATION_APPROVED} from '@fuzdev/fuz_app/db/cell_moderation.js';

cell.moderation for an approved contribution.

cell_moderation_is_stewardable
#

db/cell_moderation.ts view source

(moderation: string | null): boolean import {cell_moderation_is_stewardable} from '@fuzdev/fuz_app/db/cell_moderation.js';

Whether a cell's moderation marker is one its governing root's manager stewards — exactly 'pending' or 'rejected'.

moderation

the cell's moderation column

type string | null

returns

boolean

whether the steward read arm may admit the cell

cell_moderation_is_stewardable_sql
#

db/cell_moderation.ts view source

(alias: string): string import {cell_moderation_is_stewardable_sql} from '@fuzdev/fuz_app/db/cell_moderation.js';

SQL form of cell_moderation_is_stewardable over the cell alias alias.

alias

the cell table alias in the enclosing query

type string

returns

string

the SQL predicate

CELL_MODERATION_PENDING
#

db/cell_moderation.ts view source

"pending" import {CELL_MODERATION_PENDING} from '@fuzdev/fuz_app/db/cell_moderation.js';

cell.moderation for a gated contribution awaiting a decision.

CELL_MODERATION_REJECTED
#

db/cell_moderation.ts view source

"rejected" import {CELL_MODERATION_REJECTED} from '@fuzdev/fuz_app/db/cell_moderation.js';

cell.moderation for a rejected contribution.

Imported by
#