mirror of
https://github.com/acid-info/Kurate.git
synced 2025-01-12 08:54:08 +00:00
fix: creating post behavior and copy (#343)
This commit is contained in:
parent
24d56a02de
commit
30b6cef3d7
@ -281,7 +281,7 @@ export class Firebase implements Adapter {
|
||||
text: string,
|
||||
images: string[],
|
||||
signer: Signer,
|
||||
): Promise<void> {
|
||||
): Promise<string> {
|
||||
const address = await signer.getAddress()
|
||||
const isMemberOfGroup = get(personas).all.get(groupId)?.participants?.includes(address)
|
||||
|
||||
@ -304,7 +304,7 @@ export class Firebase implements Adapter {
|
||||
|
||||
// Store post to pending
|
||||
const pendingPosts = collection(db, `personas/${groupId}/pending`)
|
||||
addDoc(pendingPosts, post)
|
||||
const postDoc = await addDoc(pendingPosts, post)
|
||||
|
||||
const profileCollection = collection(db, `users/${address}/transactions`)
|
||||
await addDoc(profileCollection, {
|
||||
@ -322,6 +322,8 @@ export class Firebase implements Adapter {
|
||||
{ address, go: go - NEW_POST_GO_PRICE, repTotal, repStaked: repStaked + NEW_POST_REP_PRICE },
|
||||
{ merge: true },
|
||||
)
|
||||
|
||||
return postDoc.id
|
||||
}
|
||||
|
||||
async subscribePersonaPosts(groupId: string): Promise<() => unknown> {
|
||||
|
@ -404,7 +404,7 @@ export class InMemoryAndIPFS implements Adapter {
|
||||
text: string,
|
||||
images: string[],
|
||||
signer: Signer,
|
||||
): Promise<void> {
|
||||
): Promise<string> {
|
||||
await signer.signMessage('This "transaction" publishes a post to pending')
|
||||
|
||||
const post = {
|
||||
@ -430,6 +430,8 @@ export class InMemoryAndIPFS implements Adapter {
|
||||
})
|
||||
return { transactions }
|
||||
})
|
||||
|
||||
return post.postId
|
||||
}
|
||||
|
||||
async subscribePersonaPosts(groupId: string): Promise<() => unknown> {
|
||||
|
@ -26,7 +26,7 @@ export interface Adapter {
|
||||
uploadPicture(picture: string): Promise<string>
|
||||
getPicture(cid: string): string
|
||||
|
||||
publishPost(groupId: string, text: string, images: string[], signer: Signer): Promise<void>
|
||||
publishPost(groupId: string, text: string, images: string[], signer: Signer): Promise<string>
|
||||
subscribePersonaPosts(groupId: string): Promise<() => unknown>
|
||||
voteOnPost(groupId: string, postId: string, vote: '+' | '-', signer: Signer): Promise<void>
|
||||
|
||||
|
@ -332,7 +332,7 @@ export class ZkitterAdapter implements Adapter {
|
||||
text: string,
|
||||
images: string[],
|
||||
signer: Signer,
|
||||
): Promise<void> {
|
||||
): Promise<string> {
|
||||
// FIXME: properly implement
|
||||
console.error('NOT IMPLEMENTED', 'publishPost', signer)
|
||||
|
||||
@ -344,6 +344,8 @@ export class ZkitterAdapter implements Adapter {
|
||||
}
|
||||
|
||||
posts.addPending(post, groupId)
|
||||
|
||||
return post.postId
|
||||
}
|
||||
|
||||
async subscribePersonaPosts(groupId: string): Promise<() => unknown> {
|
||||
|
@ -153,7 +153,7 @@
|
||||
<Banner icon={Info} variant="danger">No GO left in this cycle</Banner>
|
||||
{/if}
|
||||
<div class={`header ${y > 0 ? 'scrolled' : ''}`}>
|
||||
<Header title={`Pending • ${persona.name}`} onBack={() => history.back()}>
|
||||
<Header title={`Pending • ${persona.name}`} onBack={() => goto(ROUTES.PERSONA(groupId))}>
|
||||
{#if $profile.signer !== undefined}
|
||||
<Button variant="primary" icon={Edit} on:click={() => goto(ROUTES.POST_NEW(groupId))} />
|
||||
{:else}
|
||||
|
@ -16,6 +16,8 @@
|
||||
import { page } from '$app/stores'
|
||||
import { personas } from '$lib/stores/persona'
|
||||
import { NEW_POST_GO_PRICE, NEW_POST_REP_PRICE } from '$lib/constants'
|
||||
import { ROUTES } from '$lib/routes'
|
||||
import { goto } from '$app/navigation'
|
||||
|
||||
const persona = $personas.all.get($page.params.id)
|
||||
|
||||
@ -166,15 +168,20 @@
|
||||
</div>
|
||||
<h2>Your post is now pending review</h2>
|
||||
<p>
|
||||
Your post has been added to "Persona name's" pending list for community review. If it gets
|
||||
promoted it will be automatically published to "Persona name's" page when the new epoch
|
||||
Your post has been added to "{persona.name}'s" pending list for community review. If it gets
|
||||
promoted it will be automatically published to "{persona.name}'s" page when the new epoch
|
||||
begins.
|
||||
</p>
|
||||
<LearnMore href="/" />
|
||||
</div>
|
||||
|
||||
<svelte:fragment slot="buttons">
|
||||
<Button icon={Checkmark} variant="primary" label="Done" on:click={() => history.back()} />
|
||||
<Button
|
||||
icon={Checkmark}
|
||||
variant="primary"
|
||||
label="Done"
|
||||
on:click={() => goto(ROUTES.PERSONA_PENDING(persona.personaId))}
|
||||
/>
|
||||
</svelte:fragment>
|
||||
</InfoScreen>
|
||||
{/if}
|
||||
|
Loading…
x
Reference in New Issue
Block a user