Skip to main content

useModeration

Introduction

The useModeration hook provides community managers (CMs) with essential functionalities to moderate posts, manage reports, and handle member rights efficiently. It simplifies the approval and rejection workflows, making it easier to build a custom UI for moderation.

Hook Properties

PropertyTypeDescription
selectedTabstringCurrently selected moderation tab.
selectTab(tab: string) => voidFunction to change the selected tab.
isPostApprovalEnabledbooleanIndicates if post approval is enabled.
reportsGroupReport[]List of reported posts.
postsRecord<string, Post>Collection of posts.
commentsRecord<string, Comment>Collection of comments.
usersRecord<string, User>Collection of users.
widgetsRecord<string, Widget>Collection of widgets.
topicsRecord<string, Topic>Collection of topics.
handleOnApprovedPostClicked(reportIds: number[]) => Promise<void>Function to approve posts.
handleOnRejectedPostClicked(reportIds: number[]) => Promise<void>Function to reject posts.
onApprovedCallback(groupReport: GroupReport) => Promise<void>Callback triggered after a post is approved.
onRejectedCallback(groupReport: GroupReport, postId: string) => Promise<void>Callback triggered after a post is rejected.
editMemberPermissionsHandler(uuid: string) => Promise<void>Function to edit member permissions.
updateMemberRightsHandler() => Promise<void>Function to update member rights.
handleHeaderLeadingTap() => voidFunction triggered on leading header tap.
handleHeaderTextTap() => voidFunction triggered on header text tap.
handleHeaderTrailingTap() => voidFunction triggered on trailing header tap.
memberRightsMemberRights[]List of member rights.
isEditPermissionDialogOpenbooleanIndicates if the edit permission dialog is open.
setIsEditPermissionDialogOpenReact.Dispatch<React.SetStateAction<boolean>>Function to toggle the edit permission dialog.
modifiedRightsMemberRights[]List of modified rights.
setModifiedRightsReact.Dispatch<React.SetStateAction<MemberRights[] >>Function to set modified rights.
customTitlestringCustom title for the moderation section.
setCustomTitleReact.Dispatch<React.SetStateAction<string>>Function to set the custom title.
currentReportGroupReport | nullCurrently selected report.
setCurrentReportReact.Dispatch<React.SetStateAction<GroupReport | null>>Function to set the current report.
loadMoreFeedsbooleanIndicates if more feeds should be loaded.
getNextPage() => voidFunction to fetch the next page of moderation data.
isLoadingbooleanIndicates if data is currently being loaded.

Example

For an example implementation, check out this reference.