Search in sources :

Example 1 with GroupMembersSlice

use of im.actor.core.entity.GroupMembersSlice in project actor-platform by actorapp.

the class GroupsModule method loadMembers.

public Promise<GroupMembersSlice> loadMembers(int gid, int limit, byte[] next) {
    return getGroups().getValueAsync(gid).flatMap(group -> api(new RequestLoadMembers(new ApiGroupOutPeer(group.getGroupId(), group.getAccessHash()), limit, next))).chain(r -> updates().loadRequiredPeers(r.getUsers(), new ArrayList<>())).map(r -> {
        ArrayList<GroupMember> members = new ArrayList<>();
        for (ApiMember p : r.getMembers()) {
            boolean isAdmin = p.isAdmin() != null ? p.isAdmin() : false;
            members.add(new GroupMember(p.getUid(), p.getInviterUid(), p.getInviterUid(), isAdmin));
        }
        return new GroupMembersSlice(members, r.getNext());
    });
}
Also used : ModuleContext(im.actor.core.modules.ModuleContext) ApiGroupType(im.actor.core.api.ApiGroupType) RequestKickUser(im.actor.core.api.rpc.RequestKickUser) RequestLoadAdminSettings(im.actor.core.api.rpc.RequestLoadAdminSettings) ResponseInviteUrl(im.actor.core.api.rpc.ResponseInviteUrl) RandomUtils(im.actor.core.util.RandomUtils) RequestEditGroupShortName(im.actor.core.api.rpc.RequestEditGroupShortName) RequestInviteUser(im.actor.core.api.rpc.RequestInviteUser) RequestTransferOwnership(im.actor.core.api.rpc.RequestTransferOwnership) RequestEditGroupTitle(im.actor.core.api.rpc.RequestEditGroupTitle) RequestJoinGroupByPeer(im.actor.core.api.rpc.RequestJoinGroupByPeer) ApiSupportConfiguration(im.actor.core.modules.api.ApiSupportConfiguration) ApiAdminSettings(im.actor.core.api.ApiAdminSettings) RequestGetIntegrationToken(im.actor.core.api.rpc.RequestGetIntegrationToken) Void(im.actor.runtime.actors.messages.Void) RequestRevokeInviteUrl(im.actor.core.api.rpc.RequestRevokeInviteUrl) GroupMember(im.actor.core.entity.GroupMember) ApiOutPeer(im.actor.core.api.ApiOutPeer) RequestCreateGroup(im.actor.core.api.rpc.RequestCreateGroup) MVVMCollection(im.actor.runtime.mvvm.MVVMCollection) ActorSystem.system(im.actor.runtime.actors.ActorSystem.system) RequestLeaveAndDelete(im.actor.core.api.rpc.RequestLeaveAndDelete) GroupAvatarVM(im.actor.core.viewmodel.GroupAvatarVM) List(java.util.List) RequestEditGroupAbout(im.actor.core.api.rpc.RequestEditGroupAbout) Peer(im.actor.core.entity.Peer) ApiUserOutPeer(im.actor.core.api.ApiUserOutPeer) Function(im.actor.runtime.function.Function) ApiPeerType(im.actor.core.api.ApiPeerType) RequestMakeUserAdminObsolete(im.actor.core.api.rpc.RequestMakeUserAdminObsolete) Promise(im.actor.runtime.promise.Promise) HashMap(java.util.HashMap) GroupVM(im.actor.core.viewmodel.GroupVM) ArrayList(java.util.ArrayList) AbsModule(im.actor.core.modules.AbsModule) User(im.actor.core.entity.User) BusSubscriber(im.actor.runtime.eventbus.BusSubscriber) GroupAvatarChangeActor(im.actor.core.modules.profile.avatar.GroupAvatarChangeActor) RequestSaveAdminSettings(im.actor.core.api.rpc.RequestSaveAdminSettings) RequestRevokeIntegrationToken(im.actor.core.api.rpc.RequestRevokeIntegrationToken) GroupMembersSlice(im.actor.core.entity.GroupMembersSlice) PeerChatOpened(im.actor.core.events.PeerChatOpened) ActorRef(im.actor.runtime.actors.ActorRef) RequestDismissUserAdmin(im.actor.core.api.rpc.RequestDismissUserAdmin) PeerType(im.actor.core.entity.PeerType) RequestLeaveGroup(im.actor.core.api.rpc.RequestLeaveGroup) RequestLoadMembers(im.actor.core.api.rpc.RequestLoadMembers) RequestShareHistory(im.actor.core.api.rpc.RequestShareHistory) RequestJoinGroup(im.actor.core.api.rpc.RequestJoinGroup) ApiMember(im.actor.core.api.ApiMember) Group(im.actor.core.entity.Group) PeerInfoOpened(im.actor.core.events.PeerInfoOpened) GroupRouterInt(im.actor.core.modules.groups.router.GroupRouterInt) RequestDeleteGroup(im.actor.core.api.rpc.RequestDeleteGroup) Storage(im.actor.runtime.Storage) ResponseIntegrationToken(im.actor.core.api.rpc.ResponseIntegrationToken) RequestGetGroupInviteUrl(im.actor.core.api.rpc.RequestGetGroupInviteUrl) ApiGroupOutPeer(im.actor.core.api.ApiGroupOutPeer) ResponseVoid(im.actor.core.api.rpc.ResponseVoid) GroupPermissions(im.actor.core.entity.GroupPermissions) KeyValueEngine(im.actor.runtime.storage.KeyValueEngine) Event(im.actor.runtime.eventbus.Event) RequestEditGroupTopic(im.actor.core.api.rpc.RequestEditGroupTopic) Promises(im.actor.runtime.promise.Promises) GroupMember(im.actor.core.entity.GroupMember) RequestLoadMembers(im.actor.core.api.rpc.RequestLoadMembers) ArrayList(java.util.ArrayList) GroupMembersSlice(im.actor.core.entity.GroupMembersSlice) ApiGroupOutPeer(im.actor.core.api.ApiGroupOutPeer) ApiMember(im.actor.core.api.ApiMember)

Aggregations

ApiAdminSettings (im.actor.core.api.ApiAdminSettings)1 ApiGroupOutPeer (im.actor.core.api.ApiGroupOutPeer)1 ApiGroupType (im.actor.core.api.ApiGroupType)1 ApiMember (im.actor.core.api.ApiMember)1 ApiOutPeer (im.actor.core.api.ApiOutPeer)1 ApiPeerType (im.actor.core.api.ApiPeerType)1 ApiUserOutPeer (im.actor.core.api.ApiUserOutPeer)1 RequestCreateGroup (im.actor.core.api.rpc.RequestCreateGroup)1 RequestDeleteGroup (im.actor.core.api.rpc.RequestDeleteGroup)1 RequestDismissUserAdmin (im.actor.core.api.rpc.RequestDismissUserAdmin)1 RequestEditGroupAbout (im.actor.core.api.rpc.RequestEditGroupAbout)1 RequestEditGroupShortName (im.actor.core.api.rpc.RequestEditGroupShortName)1 RequestEditGroupTitle (im.actor.core.api.rpc.RequestEditGroupTitle)1 RequestEditGroupTopic (im.actor.core.api.rpc.RequestEditGroupTopic)1 RequestGetGroupInviteUrl (im.actor.core.api.rpc.RequestGetGroupInviteUrl)1 RequestGetIntegrationToken (im.actor.core.api.rpc.RequestGetIntegrationToken)1 RequestInviteUser (im.actor.core.api.rpc.RequestInviteUser)1 RequestJoinGroup (im.actor.core.api.rpc.RequestJoinGroup)1 RequestJoinGroupByPeer (im.actor.core.api.rpc.RequestJoinGroupByPeer)1 RequestKickUser (im.actor.core.api.rpc.RequestKickUser)1