mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 00:25:17 +00:00
Returns the list of conversations with the memberships
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { UserMembershipEntry, UserMembershipType } from "../entities/UserMembershipEntry";
|
||||
import { FriendsHelper } from "./FriendsHelper";
|
||||
import { GroupsHelper } from "./GroupsHelper";
|
||||
import { ConversationsHelper } from "./ConversationsHelper";
|
||||
|
||||
/**
|
||||
* Web applications helper
|
||||
@ -20,6 +21,7 @@ export class WebappHelper {
|
||||
// Get the list of friends of the user
|
||||
const friendsList = await FriendsHelper.GetList(userID);
|
||||
const groupsList = await GroupsHelper.GetListUser(userID);
|
||||
const conversationsList = await ConversationsHelper.GetListUser(userID);
|
||||
|
||||
const list : Array<UserMembershipEntry> = [];
|
||||
|
||||
@ -31,6 +33,13 @@ export class WebappHelper {
|
||||
for(const g of groupsList) list.push(new UserMembershipEntry(
|
||||
await GroupsHelper.GetLastActivity(userID, g), g, UserMembershipType.GROUP));
|
||||
|
||||
// Add conversations to the list
|
||||
conversationsList.forEach(c => list.push(new UserMembershipEntry(
|
||||
c.lastActive,
|
||||
c,
|
||||
UserMembershipType.CONVERSATION
|
||||
)))
|
||||
|
||||
// Sort entries by latest activities
|
||||
list.sort((a, b) => b.lastActivity - a.lastActivity);
|
||||
|
||||
|
Reference in New Issue
Block a user