canFlagMessage

fun canFlagMessage(flagEnabled: Boolean, currentUser: User?, message: Message, ownCapabilities: Set<String>): Boolean

Determines whether the given message can be flagged.

A message can be flagged when:

  • Flag functionality is enabled in the UI configuration

  • The user has the capability to flag messages in the channel

  • The message was not sent by the current user (users cannot flag their own messages)

Return

true if the message can be flagged, false otherwise.

Parameters

flagEnabled

Whether the flag message feature is enabled in the UI.

currentUser

The currently authenticated user.

message

The message to check for flag eligibility.

ownCapabilities

The set of capabilities the current user has in the channel.