Issho.Comments.Ops (Issho v0.4.0)

Copy Markdown View Source

The operations of a room's comments document (Issho.Engine.Comments), for a LiveView, an agent's participant, or your own code to commit:

ada = Issho.Identity.new(%{id: "user:ada", name: "Ada"})
{op, %{thread: thread}} = Issho.Comments.Ops.start(ada, place, "Should this go first?")
{:ok, _} = Issho.Live.transact(room, Issho.Comments.document(room), [op])

A new comment is its author's, as their identity says it (author/1), at the server's time: the comments document's hook holds it to who commits it.

Summary

Functions

A comment's author, as an identity says it: its key, name, kind, avatar and colour, and the key and name of whom it acts for.

A deletion of one's own comment.

An edit of one's own comment.

A thread at another place (its component's content moved).

A reaction to a comment.

A thread reopened.

A reply in a thread: {op, %{thread: id, comment: id}}.

A thread resolved.

A thread at a place, with its first comment: {op, %{thread: id, comment: id}}.

A reaction taken back.

Functions

author(identity)

@spec author(Issho.Identity.t()) :: map()

A comment's author, as an identity says it: its key, name, kind, avatar and colour, and the key and name of whom it acts for.

delete(thread, comment)

@spec delete(String.t(), String.t()) :: map()

A deletion of one's own comment.

edit(thread, comment, body, opts \\ [])

@spec edit(String.t(), String.t(), String.t(), keyword()) :: map()

An edit of one's own comment.

place(thread, place)

@spec place(String.t(), map() | nil) :: map()

A thread at another place (its component's content moved).

react(thread, comment, emoji)

@spec react(String.t(), String.t(), String.t()) :: map()

A reaction to a comment.

reopen(thread)

@spec reopen(String.t()) :: map()

A thread reopened.

reply(by, thread, body, opts \\ [])

@spec reply(Issho.Identity.t(), String.t(), String.t(), keyword()) :: {map(), map()}

A reply in a thread: {op, %{thread: id, comment: id}}.

resolve(thread)

@spec resolve(String.t()) :: map()

A thread resolved.

start(by, place, body, opts \\ [])

@spec start(Issho.Identity.t(), map() | nil, String.t(), keyword()) :: {map(), map()}

A thread at a place, with its first comment: {op, %{thread: id, comment: id}}.

unreact(thread, comment, emoji)

@spec unreact(String.t(), String.t(), String.t()) :: map()

A reaction taken back.