Readers react to an entry with an emoji, one of the app's (:reactions
of Tayori.Config), and each reaction counts once per reader. The
:reactions feature.
A visitor (a reader with no id) cannot react: a reaction is a reader's, so that a count is people, not clicks.
Summary
Functions
The counts of each emoji of the entries, %{entry_id => %{emoji => n}},
and the reader's own reactions, %{entry_id => [emoji]}.
Turns a reaction of the reader on or off, and returns the entry's counts
and the reader's reactions. An emoji that is not one of the app's is
refused, and so is any reaction while the :reactions feature is off.
The number of reactions of each entry, for the admin.
Functions
@spec for_entries(Tayori.Reader.t(), [Ecto.UUID.t()]) :: {map(), map()}
The counts of each emoji of the entries, %{entry_id => %{emoji => n}},
and the reader's own reactions, %{entry_id => [emoji]}.
@spec toggle(Tayori.Reader.t(), Ecto.UUID.t(), String.t()) :: {:ok, %{counts: map(), mine: [String.t()]}} | {:error, :visitor | :unknown_emoji | :disabled}
Turns a reaction of the reader on or off, and returns the entry's counts
and the reader's reactions. An emoji that is not one of the app's is
refused, and so is any reaction while the :reactions feature is off.
@spec totals([Ecto.UUID.t()]) :: %{required(Ecto.UUID.t()) => non_neg_integer()}
The number of reactions of each entry, for the admin.