API reference
MarkdownSource ↗

Actions Hooks

Actions Hooks in Bitsocial React Hooks. Usage, options, and examples.

useSubscribe({communityAddress: string}): {subscribed: boolean | undefined, subscribe: Function, unsubscribe: Function}
useBlock({address?: string, cid?: string}): {blocked: boolean | undefined, block: Function, unblock: Function}
useSaveComment({commentCid: string}): {saved: boolean | undefined, saveComment: Function, unsaveComment: Function}
usePublishComment(options: UsePublishCommentOptions): {index: number, abandonPublish: () => Promise<void>, ...UsePublishCommentResult}
usePublishVote(options: UsePublishVoteOptions): {abandonPublish: () => Promise<void>, ...UsePublishVoteResult}
usePublishCommentEdit(options: UsePublishCommentEditOptions): UsePublishCommentEditResult
usePublishCommentModeration(options: UsePublishCommentModerationOptions): UsePublishCommentModerationResult
usePublishCommunityEdit(options: UsePublishCommunityEditOptions): UsePublishCommunityEditResult
useCreateCommunity(options: CreateCommunityOptions): {createdCommunity: Community | undefined, createCommunity: Function}
useExportCommunity(options?: UseExportCommunityOptions): {
  communityExports: {communityAddress: string, exportId: string}[],
  exportCommunity: () => Promise<void>,
  state: string,
  error: Error | undefined,
  errors: Error[]
}

Before publishComment, publishCommentEdit, publishVote, publishCommentModeration, or publishCommunityEdit signs a publication, hooks load the community challenge configuration and apply compatible wordfilters. The current @bitsocial/wordfilter-challenge contract uses a JSON array of {src, dst} objects in wordfilter/v1/rules and an optional JSON array of dot-notation paths in wordfilter/v1/fieldNames, both published through publicOptions. Every path starts with the publication type and is resolved against the publication being signed, so a path for another type is simply skipped. Without configured paths the defaults apply: comment.content, comment.title, comment.author.displayName, commentEdit.content, commentEdit.reason, commentEdit.author.displayName, and vote.author.displayName. Moderator and owner text is opt-in through configured paths (commentModeration.commentModeration.reason, communityEdit.communityEdit.title, communityEdit.communityEdit.description); structural and signing fields are never rewritten by community configuration. Matching is literal and case-insensitive, not regular-expression or Unicode-evasion matching. The transformed values are the values signed, published, and stored as the pending account publication. If composed rule sets do not stabilize within eight passes, publication stops before signing.