Skip to content

Commit

Permalink
Fix/deleted comments (#3774)
Browse files Browse the repository at this point in the history
fix: deleted comments
  • Loading branch information
mariojsnunes authored Jul 14, 2024
1 parent 71f1ed4 commit 1b08f98
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/stores/Discussions/discussions.store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class DiscussionStore extends ModuleStore {
.collection<IDiscussion>(COLLECTION_NAME)
.doc(discussion._id)

const currentDiscussion = toJS(await dbRef.get())
const currentDiscussion = toJS(await dbRef.get('server'))

if (!currentDiscussion) {
throw new Error('Discussion not found')
Expand Down Expand Up @@ -145,7 +145,7 @@ export class DiscussionStore extends ModuleStore {
.collection<IDiscussion>(COLLECTION_NAME)
.doc(discussion._id)

const currentDiscussion = toJS(await dbRef.get())
const currentDiscussion = toJS(await dbRef.get('server'))

if (currentDiscussion) {
const targetComment = currentDiscussion.comments.find(
Expand Down Expand Up @@ -187,7 +187,7 @@ export class DiscussionStore extends ModuleStore {
.collection<IDiscussion>(COLLECTION_NAME)
.doc(discussion._id)

const currentDiscussion = toJS(await dbRef.get())
const currentDiscussion = toJS(await dbRef.get('server'))

if (currentDiscussion) {
const targetComment = currentDiscussion.comments.find(
Expand Down Expand Up @@ -239,7 +239,7 @@ export class DiscussionStore extends ModuleStore {
.collection<IResearch.Item>(collectionName)
.doc(discussion.primaryContentId)

const research = toJS(await researchRef.get())
const research = toJS(await researchRef.get('server'))

if (research) {
const updateIndex = research.updates.findIndex(
Expand Down Expand Up @@ -274,7 +274,7 @@ export class DiscussionStore extends ModuleStore {
const dbRef = this.db
.collection<IDiscussionSourceModelOptions>(collectionName)
.doc(discussion.sourceId)
const parentContent = toJS(await dbRef.get())
const parentContent = toJS(await dbRef.get('server'))
const parentPath =
collectionName === 'howtos' ? 'how-to' : collectionName

Expand Down Expand Up @@ -334,7 +334,7 @@ export class DiscussionStore extends ModuleStore {
): Promise<IDiscussionDB | null> {
await dbRef.set({ ...cloneDeep(discussion) })
await updateDiscussionMetadata(this.db, discussion, commentsTotalEvent)
const updatedDiscussion = toJS(await dbRef.get())
const updatedDiscussion = toJS(await dbRef.get('server'))

return updatedDiscussion ? updatedDiscussion : null
}
Expand Down

0 comments on commit 1b08f98

Please sign in to comment.