updating nicely
This commit is contained in:
@@ -79,7 +79,8 @@ export default class ConversationService {
|
|||||||
async updateUserConvoRelationship(
|
async updateUserConvoRelationship(
|
||||||
userId: string,
|
userId: string,
|
||||||
convoId: string,
|
convoId: string,
|
||||||
newState: ConversationMemberState
|
newState: ConversationMemberState,
|
||||||
|
changeLastInteractionDate: boolean = true
|
||||||
) {
|
) {
|
||||||
const docRef = doc(
|
const docRef = doc(
|
||||||
this.db,
|
this.db,
|
||||||
@@ -88,14 +89,18 @@ export default class ConversationService {
|
|||||||
Collections.conversationMembers,
|
Collections.conversationMembers,
|
||||||
userId
|
userId
|
||||||
);
|
);
|
||||||
await setDoc(
|
|
||||||
docRef,
|
const newUpdates = changeLastInteractionDate
|
||||||
{
|
? {
|
||||||
state: newState,
|
state: newState,
|
||||||
lastUpdatedDate: serverTimestamp(),
|
lastUpdatedDate: serverTimestamp(),
|
||||||
lastInteractionDate: serverTimestamp(),
|
lastInteractionDate: serverTimestamp(),
|
||||||
},
|
}
|
||||||
{ merge: true }
|
: {
|
||||||
);
|
state: newState,
|
||||||
|
lastUpdatedDate: serverTimestamp(),
|
||||||
|
};
|
||||||
|
|
||||||
|
await setDoc(docRef, newUpdates, { merge: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,8 @@ export const doneConvosSelector = selector<Conversation[]>({
|
|||||||
conversationService.updateUserConvoRelationship(
|
conversationService.updateUserConvoRelationship(
|
||||||
userConvoAssoc.id,
|
userConvoAssoc.id,
|
||||||
conv.id,
|
conv.id,
|
||||||
ConversationMemberState.default
|
ConversationMemberState.default,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user