Class ChannelExtensionKt
-
- All Implemented Interfaces:
public final class ChannelExtensionKt
-
-
Method Summary
Modifier and Type Method Description final static BooleanisAnonymousChannel(Channel $self)Checks if the channel is an anonymous channel (without name). final static BooleanisPinned(Channel $self)Checks if the channel is pinned or not for the current user. final static BooleanisArchive(Channel $self)Checks if the channel is archived or not for the current user. final static BooleanisMutedFor(Channel $self, User user)Checks if Channel is muted for user. final static List<User>getUsersExcludingCurrent(Channel $self, User currentUser)Returns a list of users that are members of the channel excluding the currently logged in user. final static List<Member>getMembersExcludingCurrent(Channel $self, User currentUser)Returns a list of members of the channel excluding the currently logged in user. final static IntegercountUnreadMentionsForUser(Channel $self, User user)Counts messages in which user is mentioned. final static IntegercurrentUserUnreadCount(Channel $self, String currentUserId)Returns the number of unread messages in the channel for the current user. final static ChannelsyncUnreadCountWithReads(Channel $self, String currentUserId)Synchronizes the unread count of the channel with the read state of the current user. -
-
Method Detail
-
isAnonymousChannel
final static Boolean isAnonymousChannel(Channel $self)
Checks if the channel is an anonymous channel (without name).
-
isPinned
final static Boolean isPinned(Channel $self)
Checks if the channel is pinned or not for the current user.
- Returns:
True if the channel is pinned for the current user.
-
isArchive
final static Boolean isArchive(Channel $self)
Checks if the channel is archived or not for the current user.
- Returns:
True if the channel is archived for the current user.
-
isMutedFor
final static Boolean isMutedFor(Channel $self, User user)
Checks if Channel is muted for user.
- Returns:
True if the channel is muted for user.
-
getUsersExcludingCurrent
final static List<User> getUsersExcludingCurrent(Channel $self, User currentUser)
Returns a list of users that are members of the channel excluding the currently logged in user.
- Parameters:
currentUser- The currently logged in user.- Returns:
The list of users in the channel without the current user.
-
getMembersExcludingCurrent
final static List<Member> getMembersExcludingCurrent(Channel $self, User currentUser)
Returns a list of members of the channel excluding the currently logged in user.
- Parameters:
currentUser- The currently logged in user.- Returns:
The list of members in the channel without the current user.
-
countUnreadMentionsForUser
final static Integer countUnreadMentionsForUser(Channel $self, User user)
Counts messages in which user is mentioned. The method relies on the Channel.messages list and doesn't do any API call. Therefore, the count might be not reliable as it relies on the local data.
- Parameters:
user- The User object for which unread mentions are counted.- Returns:
Number of messages containing unread user mention.
-
currentUserUnreadCount
final static Integer currentUserUnreadCount(Channel $self, String currentUserId)
Returns the number of unread messages in the channel for the current user.
- Returns:
The number of unread messages in the channel for the current user.
-
syncUnreadCountWithReads
final static Channel syncUnreadCountWithReads(Channel $self, String currentUserId)
Synchronizes the unread count of the channel with the read state of the current user.
- Parameters:
currentUserId- The ID of the current user.- Returns:
A new instance of the channel with the unread count synchronized with the read state of the current user.
-
-
-
-