canDeleteMessage

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

Determines whether the given message can be deleted.

A message can be deleted when:

  • Delete message functionality is enabled in the UI configuration

  • The user has permission to delete their own messages and it's their message, OR they can delete any message

Return

true if the message can be deleted, false otherwise.

Parameters

deleteMessageEnabled

Whether the delete message feature is enabled in the UI.

currentUser

The currently authenticated user.

message

The message to check for delete eligibility.

ownCapabilities

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