Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Correctly identify if new post requires moderation.

Matt Robertseb2115388143
diff --git a/app/handlers/apiv1/post.go b/app/handlers/apiv1/post.go
index e47a22e2f..11fc0c283 100644
--- a/app/handlers/apiv1/post.go
+++ b/app/handlers/apiv1/post.go
@@ -102,7 +102,8 @@ func CreatePost() web.HandlerFunc {
"id": newPost.Result.ID,
"number": newPost.Result.Number,
"title": newPost.Result.Title,
- "slug": newPost.Result.Slug,
+ "slug": newPost.Result.Slug,
+ "isApproved": newPost.Result.IsApproved,
})
}
}
diff --git a/public/pages/Home/components/ShareFeedback.tsx b/public/pages/Home/components/ShareFeedback.tsx
index 5a99410df..84ae1d494 100644
--- a/public/pages/Home/components/ShareFeedback.tsx
+++ b/public/pages/Home/components/ShareFeedback.tsx
@@ -191,7 +191,7 @@ export const ShareFeedback: React.FC<ShareFeedbackProps> = (props) => {
clearError()
clearCache()
clearAttachments()
- if (fider.session.isModerationRequiredForNewPost) {
+ if (!result.data.isApproved) {
cache.session.set("POST_CREATED_MODERATION", "true")
} else {
cache.session.set("POST_CREATED_SUCCESS", "true")
diff --git a/public/pages/ShowPost/components/CommentInput.tsx b/public/pages/ShowPost/components/CommentInput.tsx
index 47aee84e5..49899b1b2 100644
--- a/public/pages/ShowPost/components/CommentInput.tsx
+++ b/public/pages/ShowPost/components/CommentInput.tsx
@@ -55,7 +55,7 @@ export const CommentInput = (props: CommentInputProps) => {
if (result.ok) {
clearAttachments()
cache.session.remove(getCacheKey(CACHE_TITLE_KEY))
- if (fider.session.tenant.isModerationEnabled && !fider.session.user.isCollaborator) {
+ if (fider.session.isModerationRequiredForNewPost) {
cache.session.set("COMMENT_CREATED_MODERATION", "true")
}
location.reload()
diff --git a/public/services/actions/post.ts b/public/services/actions/post.ts
index 0d5d605e5..b4fd7bf8a 100644
--- a/public/services/actions/post.ts
+++ b/public/services/actions/post.ts
@@ -119,6 +119,7 @@ interface CreatePostResponse {
number: number
title: string
slug: string
+ isApproved: boolean
}
export const createPost = async (title: string, description: string, attachments: ImageUpload[], tags: string[]): Promise<Result<CreatePostResponse>> => {