fix: submit post (#315)

This commit is contained in:
Vojtech Simetka 2023-04-02 16:01:06 +02:00 committed by GitHub
parent fe987feb06
commit 71930ae827
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -279,17 +279,18 @@ export class Firebase implements Adapter {
images: string[],
signer: Signer,
): Promise<void> {
const address = await signer.getAddress()
const isMemberOfGroup = get(personas).all.get(groupId)?.participants?.includes(address)
const post = {
timestamp: Date.now(),
text,
images,
promote: [],
demote: [],
address,
}
const address = await signer.getAddress()
const isMemberOfGroup = get(personas).all.get(groupId)?.participants?.includes(address)
if (!isMemberOfGroup) {
await signer.signMessage('This "transaction" joins the persona')
const personaDoc = doc(db, `personas/${groupId}`)
@ -300,7 +301,7 @@ export class Firebase implements Adapter {
// Store post to pending
const pendingPosts = collection(db, `personas/${groupId}/pending`)
addDoc(pendingPosts, { post, address })
addDoc(pendingPosts, post)
const profileCollection = collection(db, `users/${address}/transactions`)
await addDoc(profileCollection, {