m_comment (zotonic_mod_comment v1.0.0-rc.17)

Model for comments attached to resources. It provides listing, moderation checks, counting, and retrieval of individual comments.

Available Model API Paths

MethodPath patternDescription
get/anonymous/...Return whether anonymous comments are allowed; defaults to true when mod_comment.anonymous is unset.
get/moderate/...Return whether new comments require moderation; defaults to false when mod_comment.moderate is unset/empty.
get/rsc/+id/...Return all comment rows for resource +id (ascending by creation time; requires resource visibility).
get/count/+id/...Return total comment count for resource +id (requires resource visibility).
get/get/+commentid/...Return comment record +commentid, or undefined if missing; access is denied when the linked resource is not visible.

/+name marks a variable path segment. A trailing /... means extra path segments are accepted for further lookups.

Summary

Functions

delete(CommentId, Context)

get(CommentId, Context)

-spec get(integer(), z:context()) -> proplists:proplist() | undefined.

gravatar_code(Email)

-spec gravatar_code(atom() | binary() | string()) -> binary().

insert(RscId, Name, Email, Message, IsVisible, Context)

-spec insert(RscId, Name, Email, Message, IsVisible, Context) -> {ok, CommentId} | {error, any()}
                when
                    RscId :: m_rsc:resource(),
                    Name :: string() | binary(),
                    Email :: string() | binary(),
                    Message :: string() | binary(),
                    IsVisible :: boolean(),
                    Context :: z:context(),
                    CommentId :: pos_integer().

is_deletable(CommentId, Context)

list_rsc(RscId, Context)

-spec list_rsc(m_rsc:resource(), z:context()) -> list().

m_get/3

merge(WinnerId, LoserId, Context)

-spec merge(m_rsc:resource(), m_rsc:resource(), z:context()) -> ok.

search/3

toggle(CommentId, Context)