-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Parse conversation roles directly from 'conversation.create' event [FS-1659] #14916
Conversation
const data = await this.conversationService.getConversationById(conversationEntity); | ||
const allMembers = [...data.members.others, data.members.self]; | ||
const conversationRoles = allMembers.reduce<Record<string, string>>((roles, member) => { | ||
roles[member.id] = member.conversation_role; | ||
return roles; | ||
}, {}); | ||
conversationEntity.roles(conversationRoles); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where we fetched the conversation for a second time and then mapped the roles (this is now done in the ConversationMapper
)
@@ -89,10 +87,6 @@ export class ConversationRoleRepository { | |||
} | |||
}; | |||
|
|||
readonly setConversationRoles = (conversation: Conversation, newRoles: ConversationRole[]): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was never used
Codecov Report
@@ Coverage Diff @@
## dev #14916 +/- ##
==========================================
+ Coverage 42.94% 42.96% +0.02%
==========================================
Files 623 623
Lines 21297 21294 -3
Branches 4891 4892 +1
==========================================
+ Hits 9145 9148 +3
+ Misses 10993 10986 -7
- Partials 1159 1160 +1 |
Currently the flow for creating a conversation locally when it was create by someone else if:
conversation.create
eventBut, the
conversation.create
event actually contains everything we need to also compute the roles directly.This PR removes the extra fetch request and computes the roles directly from the payload the
conversation.create
event