CommunityModeration Class

Access information about flags feed items and comments in a community. Add and remove one or more flags to and from comments and feed items. To view a feed containing all flagged feed items and comments, pass ConnectApi.FeedType.Moderation to the ConnectApi.ChatterFeeds.getFeedItemsFromFeed method.

Namespace

ConnectApi

CommunityModeration Methods

The following are methods for CommunityModeration. All methods are static.

addFlagToComment(communityId, commentId)

Add a moderation flag to a comment. To add a flag to a comment, Allow members to flag content must be selected for a community.

API Version

29.0

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationFlags addFlagToComment(String communityId, String commentId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
commentId
Type: String
The ID for a comment.

Return Value

Type: ConnectApi.​ModerationFlags

addFlagToComment(communityId, commentId, visibility)

Add a moderation flag with specified visibility to a comment. To add a flag to a comment, Allow members to flag content must be selected for a community.

API Version

30.0

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationFlags addFlagToComment(String communityId, String commentId, ConnectApi.CommunityFlagVisibility visibility)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
commentId
Type: String
The ID for a comment.
visibility
Type: ConnectApi.​CommunityFlag​Visibility
Specifies the visibility behavior of a flag for various user types.
  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Return Value

Type: ConnectApi.​ModerationFlags

addFlagToFeedElement(communityId, feedElementId)

Add a moderation flag to a feed element. To add a flag to a feed element, Allow members to flag content must be selected for a community.

API Version

31.0

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationCapability addFlagToFeedElement(String communityId, String feedElementId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
feedElementId
Type: String
The ID for a feed element.

Return Value

Type: ConnectApi.​Moderation​Capability Class

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

addFlagToFeedElement(communityId, feedElementId, visibility)

Add a moderation flag with specified visibility to a feed element. To add a flag to a feed element, Allow members to flag content must be selected for a community.

API Version

31.0

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationCapability addFlagToFeedElement(String communityId, String feedElementId, ConnectApi.CommunityFlagVisibility visibility)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
feedElementId
Type: String
The ID for a feed element.
visibility
Type: ConnectApi.CommunityFlagVisibility
Specifies the visibility behavior of a flag for various user types. One of these values:
  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Return Value

Type: ConnectApi.​Moderation​Capability Class

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

addFlagToFeedItem(communityId, feedItemId)

Add a moderation flag to a feed item. To add a flag to a feed item, Allow members to flag content must be selected for a community.

API Version

29.0–31.0
Important

Important

In version 32.0 and later, use addFlagToFeedElement(communityId, feedElementId).

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationFlags addFlagToFeedItem(String communityId, String feedItemId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
feedItemId
Type: String
The ID for a feed item.

Return Value

Type: ConnectApi.​ModerationFlags

addFlagToFeedItem(communityId, feedItemId, visibility)

Add a moderation flag with specified visibility to a feed item. To add a flag to a feed item, Allow members to flag content must be selected for a community.

API Version

30.0–31.0
Important

Important

In version 32.0 and later, use addFlagToFeedElement(communityId, feedElementId, visibility).

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationFlags addFlagToFeedItem(String communityId, String feedItemId, ConnectApi.CommunityFlagVisibility visibility)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
feedItemId
Type: String
The ID for a feed item.
visibility
Type: ConnectApi.​CommunityFlag​Visibility
Specifies the visibility behavior of a flag for various user types.
  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Return Value

Type: ConnectApi.​ModerationFlags

getFlagsOnComment(communityId, commentId)

Get the moderation flags on a comment. To get the flags, the context user must have the “Moderate Communities Feeds” permission.

API Version

29.0

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationFlags getFlagsOnComment(String communityId, String commentId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
commentId
Type: String
The ID for a comment.

Return Value

Type: ConnectApi.​ModerationFlags

getFlagsOnComment(communityId, commentId, visibility)

Get the moderation flags with specified visibility on a comment. To get the flags, the context user must have the “Moderate Communities Feeds” permission.

API Version

30.0

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationFlags getFlagsOnComment(String communityId, String commentId, ConnectApi.CommunityFlagVisibility visibility)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
commentId
Type: String
The ID for a comment.
visibility
Type: ConnectApi.​CommunityFlag​Visibility
Specifies the visibility behavior of a flag for various user types.
  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Return Value

Type: ConnectApi.​ModerationFlags

getFlagsOnFeedElement(communityId, feedElementId)

Get the moderation flags on a feed element. To get the flags, the context user must have the Moderate Communities Feeds permission.

API Version

31.0

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationCapability getFlagsOnFeedElement(String communityId, String feedElementId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
feedElementId
Type: String
The ID for a feed element.

Return Value

Type: ConnectApi.​Moderation​Capability Class

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

getFlagsOnFeedElement(communityId, feedElementId, visibility)

Get the moderation flags with specified visibility on a feed element. To get the flags, the context user must have the Moderate Communities Feeds permission.

API Version

31.0

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationCapability getFlagsOnFeedElement(String communityId, String feedElementId, ConnectApi.CommunityFlagVisibility visibility)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
feedElementId
Type: String
The ID for a feed element.
visibility
Type: ConnectApi.CommunityFlagVisibility
Specifies the visibility behavior of a flag for various user types. One of these values:
  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Return Value

Type: ConnectApi.​Moderation​Capability Class

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

getFlagsOnFeedItem(communityId, feedItemId)

Get the moderation flags on a feed item. To get the flags, the context user must have the “Moderate Communities Feeds” permission.

API Version

29.0–31.0
Important

Important

In version 32.0 and later, use getFlagsOnFeedElement(communityId, feedElementId).

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationFlags getFlagsOnFeedItem(String communityId, String feedItemId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
feedItemId
Type: String
The ID for a feed item.

Return Value

Type: ConnectApi.​ModerationFlags

getFlagsOnFeedItem(communityId, feedItemId, visibility)

Get the moderation flags with specified visibility on a feed item. To get the flags, the context user must have the “Moderate Communities Feeds” permission.

API Version

30.0–31.0
Important

Important

In version 32.0 and later, use getFlagsOnFeedElement(communityId, feedElementId, visibility).

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationFlags getFlagsOnFeedItem(String communityId, String feedItemId, ConnectApi.CommunityFlagVisibility visibility)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
feedItemId
Type: String
The ID for a feed item.
visibility
Type: ConnectApi.​CommunityFlag​Visibility
Specifies the visibility behavior of a flag for various user types.
  • ModeratorsOnly—The flag is visible only to users with moderation permissions on the flagged element or item.
  • SelfAndModerators—The flag is visible to the creator of the flag and to users with moderation permissions on the flagged element or item.

Return Value

Type: ConnectApi.​ModerationFlags

removeFlagFromComment(communityId, commentId, userId)

Remove a moderation flag from a comment. To remove a flag from a comment the context user must have added the flag or must have the “Moderate Communities Feeds” permission.

API Version

29.0

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationFlags removeFlagFromComment(String communityId, String commentId, String userId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
commentId
Type: String
The ID for a comment.
userId
Type: String
The ID for a user.

Return Value

Type: Void

removeFlagFromFeedElement(communityId, feedElementId, userId)

Remove a moderation flag from a feed element. To remove a flag from a feed element, the context user must have added the flag or must have the Moderate Communities Feeds permission.

API Version

31.0

Requires Chatter

Yes

Signature

public static void removeFlagFromFeedElement(String communityId, String feedElementId, String userId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
feedElementId
Type: String
The ID for a feed element.
userId
Type: String
The ID for a user.

Return Value

Type: ConnectApi.​Moderation​Capability Class

If the feed element doesn’t support this capability, the return value is ConnectApi.NotFoundException.

removeFlagsOnFeedItem(communityId, feedItemId, userId)

Remove a moderation flag from a feed item. To remove a flag from a feed item, the context user must have added the flag or must have the “Moderate Communities Feeds” permission.

API Version

29.0–31.0
Important

Important

In version 32.0 and later, use removeFlagFromFeedElement(communityId, feedElementId, userId).

Requires Chatter

Yes

Signature

public static ConnectApi.ModerationFlags removeFlagsOnFeedItem(String communityId, String feedItemId, String userId)

Parameters

communityId
Type: String
Use either the ID for a community, internal, or null.
feedItemId
Type: String
The ID for a feed item.
userId
Type: String
The ID for a user.

Return Value

Type: Void