Divide Conversation into ConversationInfos, ConversationMember, and ConversationSummary
- ConversationSummary is used to display ConversationList.
- Having the three separated will help managing queries.
- Adding ConversationSummary required to solve some inconsistencies in ConversationList, which was mixing contacts and conversations. ContactSearchResultList has been added as a quick fix . It will need more work.
- Some tools to uniformize conversation names have been introduced. They will need more work.
Note the diplaying of ConversationList is left broken in this commit.
Change-Id: I29337906cc43781a9c4790735490a6ee2cc51cb0
diff --git a/client/src/models/conversation-member.ts b/client/src/models/conversation-member.ts
new file mode 100644
index 0000000..b1b213d
--- /dev/null
+++ b/client/src/models/conversation-member.ts
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 Savoir-faire Linux Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this program. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+import { ConversationMemberRole, IConversationMember } from 'jami-web-common';
+
+import { Contact } from './contact';
+
+export class ConversationMember implements IConversationMember {
+ readonly role;
+ readonly contact;
+
+ constructor(role: ConversationMemberRole | undefined, contact: Contact) {
+ this.role = role;
+ this.contact = contact;
+ }
+
+ static fromInterface(conversationMemberIterface: IConversationMember) {
+ return new ConversationMember(
+ conversationMemberIterface.role,
+ Contact.fromInterface(conversationMemberIterface.contact)
+ );
+ }
+
+ getDisplayName = () => {
+ return this.contact.getDisplayName();
+ };
+}