Package 

Class CapabilitiesHelperKt

    • Method Summary

      Modifier and Type Method Description
      final static Boolean canFlagMessage(Boolean flagEnabled, User currentUser, Message message, Set<String> ownCapabilities) Determines whether the given message can be flagged.
      final static Boolean canPinMessage(Boolean pinMessageEnabled, Message message, Set<String> ownCapabilities) Determines whether the given message can be pinned or unpinned.
      final static Boolean canMarkAsUnread(Boolean markAsUnreadEnabled, User currentUser, Message message, Set<String> ownCapabilities) Determines whether messages in the channel can be marked as unread.
      final static Boolean canReplyToMessage(Boolean replyEnabled, Message message, Set<String> ownCapabilities) Determines whether a reply (quote) can be made to the given message.
      final static Boolean canThreadReplyToMessage(Boolean threadsEnabled, Boolean isInThread, Message message, Set<String> ownCapabilities) Determines whether a thread reply can be made to the given message.
      final static Boolean canCopyMessage(Boolean copyTextEnabled, Message message) Determines whether the given message can be copied to the clipboard.
      final static Boolean canEditMessage(Boolean editMessageEnabled, User currentUser, Message message, Set<String> ownCapabilities) Determines whether the given message can be edited.
      final static Boolean canDeleteMessage(Boolean deleteMessageEnabled, User currentUser, Message message, Set<String> ownCapabilities) Determines whether the given message can be deleted.
      final static Boolean canMuteUser(Boolean muteUserEnabled, User currentUser, Message message, Channel channel) Determines whether the user who sent the given message can be muted.
      final static Boolean canBlockUser(Boolean blockUserEnabled, User currentUser, Message message) Determines whether the user who sent the given message can be blocked.
      final static Boolean canRetryMessage(Boolean retryMessageEnabled, User currentUser, Message message) Determines whether the given message can be retried.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • canFlagMessage

         final static Boolean canFlagMessage(Boolean flagEnabled, User currentUser, Message message, Set<String> ownCapabilities)

        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)

        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.
      • canPinMessage

         final static Boolean canPinMessage(Boolean pinMessageEnabled, Message message, Set<String> ownCapabilities)

        Determines whether the given message can be pinned or unpinned.

        A message can be pinned when:

        • Pin message functionality is enabled in the UI configuration

        • The message has been successfully synced with the backend

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

        Parameters:
        pinMessageEnabled - Whether the pin message feature is enabled in the UI.
        message - The message to check for pin eligibility.
        ownCapabilities - The set of capabilities the current user has in the channel.
      • canMarkAsUnread

         final static Boolean canMarkAsUnread(Boolean markAsUnreadEnabled, User currentUser, Message message, Set<String> ownCapabilities)

        Determines whether messages in the channel can be marked as unread.

        Messages can be marked as unread when:

        • Mark as unread functionality is enabled in the UI configuration

        • The user has the capability to receive read events in the channel

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

        Parameters:
        markAsUnreadEnabled - Whether the mark as unread feature is enabled in the UI.
        currentUser - The currently authenticated user.
        message - The message to check for mark as unread eligibility.
        ownCapabilities - The set of capabilities the current user has in the channel.
      • canReplyToMessage

         final static Boolean canReplyToMessage(Boolean replyEnabled, Message message, Set<String> ownCapabilities)

        Determines whether a reply (quote) can be made to the given message.

        A reply is allowed when:

        • Reply functionality is enabled in the UI configuration

        • The message has been successfully synced with the backend

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

        Parameters:
        replyEnabled - Whether the reply feature is enabled in the UI.
        message - The message to check for reply eligibility.
        ownCapabilities - The set of capabilities the current user has in the channel.
      • canThreadReplyToMessage

         final static Boolean canThreadReplyToMessage(Boolean threadsEnabled, Boolean isInThread, Message message, Set<String> ownCapabilities)

        Determines whether a thread reply can be made to the given message.

        A thread reply is allowed when:

        • Thread functionality is enabled in the UI configuration

        • The user is not currently viewing a thread

        • The message is not a thread reply

        • The message has been successfully synced with the backend

        • The user has the capability to send replies in the channel

        Parameters:
        threadsEnabled - Whether the thread feature is enabled in the UI.
        isInThread - Whether the user is currently viewing messages within a thread.
        message - The message to check for thread reply eligibility.
        ownCapabilities - The set of capabilities the current user has in the channel.
      • canCopyMessage

         final static Boolean canCopyMessage(Boolean copyTextEnabled, Message message)

        Determines whether the given message can be copied to the clipboard.

        A message can be copied when:

        • Copy text functionality is enabled in the UI configuration

        • The message contains text only (no attachments) OR contains links

        Parameters:
        copyTextEnabled - Whether the copy text feature is enabled in the UI.
        message - The message to check for copy eligibility.
      • canEditMessage

         final static Boolean canEditMessage(Boolean editMessageEnabled, User currentUser, Message message, Set<String> ownCapabilities)

        Determines whether the given message can be edited.

        A message can be edited when:

        • Edit message functionality is enabled in the UI configuration

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

        • The message is not a Giphy command

        • The message does not contain a shared location attachment

        Parameters:
        editMessageEnabled - Whether the edit message feature is enabled in the UI.
        currentUser - The currently authenticated user.
        message - The message to check for edit eligibility.
        ownCapabilities - The set of capabilities the current user has in the channel.
      • canDeleteMessage

         final static Boolean canDeleteMessage(Boolean deleteMessageEnabled, User currentUser, Message message, Set<String> ownCapabilities)

        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

        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.
      • canMuteUser

         final static Boolean canMuteUser(Boolean muteUserEnabled, User currentUser, Message message, Channel channel)

        Determines whether the user who sent the given message can be muted.

        A user can be muted when:

        • Mute user functionality is enabled in the UI configuration

        • Muting is enabled in the channel configuration

        • The message was not sent by the current user (users cannot mute themselves)

        Parameters:
        muteUserEnabled - Whether the mute user feature is enabled in the UI.
        currentUser - The currently authenticated user.
        message - The message whose sender to check for mute eligibility.
        channel - The channel where the message was sent.
      • canBlockUser

         final static Boolean canBlockUser(Boolean blockUserEnabled, User currentUser, Message message)

        Determines whether the user who sent the given message can be blocked.

        A user can be blocked when:

        • Block user functionality is enabled in the UI configuration

        • The message was not sent by the current user (users cannot block themselves)

        Parameters:
        blockUserEnabled - Whether the block user feature is enabled in the UI.
        currentUser - The currently authenticated user.
        message - The message whose sender to check for block eligibility.
      • canRetryMessage

         final static Boolean canRetryMessage(Boolean retryMessageEnabled, User currentUser, Message message)

        Determines whether the given message can be retried.

        A message can be retried when:

        • Retry message functionality is enabled in the UI configuration

        • The message was sent by the current user

        • The message has failed permanently

        Parameters:
        retryMessageEnabled - Whether the retry message feature is enabled in the UI.
        currentUser - The currently authenticated user.
        message - The message to check for retry eligibility.