MishkaCmsCore.Activity.Sources.EditorHistory (Mishka CMS Core v0.0.1)

Copy Markdown View Source

Activity source for the visual editor's own record — every change somebody made to a page, layout, component or error page in the page builder, tagged badge_label: "EDITOR".

Why it needs a source of its own

No other adapter can see these. MishkaCmsCore.Runtime.PageBuilderEvent is not AshPaperTrail versioned, is not an AshEvents log and is not an Oban job — it is a lean append-only table the editor writes as somebody works, which is exactly why the timeline in the editor is fast. That makes it invisible to the global feed unless something goes and reads it, which is this.

One store, two surfaces: the sheet inside the editor answers "what happened to THIS document", and the feed answers "what happened across the site". Neither is a copy of the other.

History only, and deliberately

The resource broadcasts nothing — pub_sub is off on it, because a row is written on every settled change and re-reading a table for everybody on every keystroke is the noise the whole design avoids. So topics/1 is empty and handles?/1 is always false: this contributes to the merged history read and never to the live tail. A change appears in the feed on the next read, which for a record of what happened is the right trade.

Two actions, in the feed's own vocabulary: publish for a publish, update for every other change — because the feed has one shared set of action words that every source reports in, and widening it for this one would change how the others render. Which change it was is in the message beside it, in the same words the editor's own timeline uses: "Set gap (base) — <nav>".

See MishkaCmsCore.Activity.Behaviours.Source and MishkaCmsCore.Activity.Query (the DB-merge branch, which owns the SQL).

Summary

Functions

Turns one merged row into a feed entry.

The resources whose feeds this source contributes to.

Functions

entry_from_row(row)

@spec entry_from_row(map()) :: map()

Turns one merged row into a feed entry.

Called by MishkaCmsCore.Activity.Query for rows its editor branch produced.

scopes()

@spec scopes() :: %{required(String.t()) => String.t()}

The resources whose feeds this source contributes to.