Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Load posts without a full page refresh.

Matt Roberts2e7ebc6381ac
diff --git a/app/const.go b/app/const.go
index 4712de971..f5ffefa76 100644
--- a/app/const.go
+++ b/app/const.go
@@ -6,12 +6,12 @@ import "errors"
var ErrNotFound = errors.New("object not found")
// ErrCommercialLicenseRequired is used when a commercial feature is accessed without a license
-var ErrCommercialLicenseRequired = errors.New("Content moderation requires a commercial license")
+var ErrCommercialLicenseRequired = errors.New("content moderation requires a commercial license")
// InvitePlaceholder represents the placeholder used by members to invite other users
var InvitePlaceholder = "%invite%"
-//ErrUserIDRequired is used when OAuth integration returns an empty user ID
+// ErrUserIDRequired is used when OAuth integration returns an empty user ID
var ErrUserIDRequired = errors.New("UserID is required during OAuth integration")
type key string
diff --git a/app/services/sqlstore/postgres/post.go b/app/services/sqlstore/postgres/post.go
index ed01419b3..887536026 100644
--- a/app/services/sqlstore/postgres/post.go
+++ b/app/services/sqlstore/postgres/post.go
@@ -269,7 +269,7 @@ func updatePost(ctx context.Context, c *cmd.UpdatePost) error {
_, err := trx.Execute(`UPDATE posts SET title = $1, slug = $2, description = $3, language = $4
WHERE id = $5 AND tenant_id = $6`, c.Title, slug.Make(c.Title), c.Description, lang, c.Post.ID, tenant.ID)
- if err != nil{
+ if err != nil {
return errors.Wrap(err, "failed update post")
}
@@ -533,10 +533,11 @@ func buildPostQuery(user *entity.User, filter string, moderationFilter string) s
// If user is a collaborator and has specified a moderation filter, apply it
if user != nil && user.IsCollaborator() && moderationFilter != "" {
- if moderationFilter == "pending" {
+ switch moderationFilter {
+ case "pending":
// Show only unapproved posts
approvalFilter = " AND p.is_approved = false"
- } else if moderationFilter == "approved" {
+ case "approved":
// Show only approved posts
approvalFilter = " AND p.is_approved = true"
}
diff --git a/locale/ar/client.json b/locale/ar/client.json
index 6c27c269e..4098b3a0f 100644
--- a/locale/ar/client.json
+++ b/locale/ar/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "فشل نسخ رابط التعليق، يرجى نسخ رابط الصفحة",
"showpost.comment.copylink.success": "تم نسخ رابط التعليق إلى الحافظة",
"showpost.comment.unknownhighlighted": "معرف تعليق غير صالح #{id}",
"showpost.commentinput.placeholder": "اترك تعليق",
"showpost.copylink.success": "تم نسخ الرابط إلى الحافظة",
+ "showpost.loading": "",
"showpost.message.nodescription": "لا يوجد وصف.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "البحث في المنشور الأصلي...",
"showpost.responseform.message.mergedvotes": "سيتم دمج التصويتات من هذا المنشور في المنشور الأصلية.",
"showpost.responseform.text.placeholder": "ما الذي يجري مع هذا المنشور؟ أخبر المستخدمين ما هي خططك...",
+ "showpost.save.success": "",
"signin.code.edit": "يحرر",
"signin.code.getnew": "احصل على رمز جديد",
"signin.code.instruction": "الرجاء كتابة الرمز الذي أرسلناه للتو إلى <0>{email}</0>",
diff --git a/locale/de/client.json b/locale/de/client.json
index 031823e3d..52a2e63c5 100644
--- a/locale/de/client.json
+++ b/locale/de/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Kommentar-Link konnte nicht kopiert werden, bitte URL der Webseite kopieren",
"showpost.comment.copylink.success": "Kommentar-Link in die Zwischenablage kopiert",
"showpost.comment.unknownhighlighted": "Ungültige Kommentar ID #{id}",
"showpost.commentinput.placeholder": "Kommentar hinzufügen",
"showpost.copylink.success": "Link in die Zwischenablage kopiert",
+ "showpost.loading": "",
"showpost.message.nodescription": "Keine Beschreibung angegeben.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Originalbeitrag suchen...",
"showpost.responseform.message.mergedvotes": "Stimmen aus diesem Beitrag werden mit den Stimmen vom ursprünglichen Beitrag zusammengeführt.",
"showpost.responseform.text.placeholder": "Was passiert in diesem Beitrag? Lass deine Benutzer wissen, was deine Pläne sind...",
+ "showpost.save.success": "",
"signin.code.edit": "Bearbeiten",
"signin.code.getnew": "Neuen Code anfordern",
"signin.code.instruction": "Bitte geben Sie den soeben gesendeten Code an <0>{email}</0> ein.",
diff --git a/locale/el/client.json b/locale/el/client.json
index bc8d3d402..6c954bd8f 100644
--- a/locale/el/client.json
+++ b/locale/el/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Η αντιγραφή του συνδέσμου σχολίου απέτυχε. Παρακαλώ αντιγράψτε τη διεύθυνση URL της σελίδας.",
"showpost.comment.copylink.success": "Ο σύνδεσμος σχολίου αντιγράφηκε στο πρόχειρο",
"showpost.comment.unknownhighlighted": "Μη έγκυρο αναγνωριστικό σχολίου #{id}",
"showpost.commentinput.placeholder": "Αφήστε ένα σχόλιο",
"showpost.copylink.success": "Ο σύνδεσμος αντιγράφηκε στο πρόχειρο",
+ "showpost.loading": "",
"showpost.message.nodescription": "Δεν υπάρχει περιγραφή.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Αναζήτηση αρχικής ανάρτησης...",
"showpost.responseform.message.mergedvotes": "Οι ψήφοι από αυτό το post θα συγχωνευτούν στο αρχικό post.",
"showpost.responseform.text.placeholder": "Τι συμβαίνει με αυτή την ανάρτηση; Αφήστε τους χρήστες σας να γνωρίζουν ποια είναι τα σχέδιά σας...",
+ "showpost.save.success": "",
"signin.code.edit": "Εκδίδω",
"signin.code.getnew": "Λήψη νέου κωδικού",
"signin.code.instruction": "Παρακαλώ πληκτρολογήστε τον κωδικό που μόλις στείλαμε στη διεύθυνση <0>{email}</0>",
diff --git a/locale/en/client.json b/locale/en/client.json
index 1865af79e..518853923 100644
--- a/locale/en/client.json
+++ b/locale/en/client.json
@@ -181,11 +181,13 @@
"pagination.next": "Next",
"pagination.prev": "Previous",
"post.pending": "pending",
+ "postdetails.backtoall": "Back to all suggestions",
"showpost.comment.copylink.error": "Could not copy comment link, please copy page URL",
"showpost.comment.copylink.success": "Successfully copied comment link to clipboard",
"showpost.comment.unknownhighlighted": "Unknown comment ID #{id}",
"showpost.commentinput.placeholder": "Leave a comment",
"showpost.copylink.success": "Link copied to clipboard",
+ "showpost.loading": "Loading...",
"showpost.message.nodescription": "No description provided.",
"showpost.moderation.admin.description": "This idea needs your approval before being published",
"showpost.moderation.admin.title": "Moderation",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Search original post...",
"showpost.responseform.message.mergedvotes": "Votes from this post will be merged into original post.",
"showpost.responseform.text.placeholder": "What's going on with this post? Let your users know what are your plans...",
+ "showpost.save.success": "Post updated successfully",
"signin.code.edit": "Edit",
"signin.code.getnew": "Get a new code",
"signin.code.instruction": "Please type in the code we just sent to <0>{email}</0>",
diff --git a/locale/es-ES/client.json b/locale/es-ES/client.json
index 2eec057c5..5b8cbfb1a 100644
--- a/locale/es-ES/client.json
+++ b/locale/es-ES/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "No se pudo copiar el enlace del comentario, copie la URL de la página",
"showpost.comment.copylink.success": "Enlace de comentario copiado al portapapeles",
"showpost.comment.unknownhighlighted": "ID de comentario no válido #{id}",
"showpost.commentinput.placeholder": "Publica un comentario",
"showpost.copylink.success": "Enlace copiado al portapapeles",
+ "showpost.loading": "",
"showpost.message.nodescription": "No se proporcionó ninguna descripción.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Buscar publicación original...",
"showpost.responseform.message.mergedvotes": "Los votos de esta publicación se fusionarán en la publicación original.",
"showpost.responseform.text.placeholder": "¿Qué está pasando con esta publicación? Dile a tus usuarios cuáles son tus planes...",
+ "showpost.save.success": "",
"signin.code.edit": "Editar",
"signin.code.getnew": "Obtén un nuevo código",
"signin.code.instruction": "Por favor, introduzca el código que le acabamos de enviar a <0>{email}</0>",
diff --git a/locale/fa/client.json b/locale/fa/client.json
index 19474176b..78a815877 100644
--- a/locale/fa/client.json
+++ b/locale/fa/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "کپی لینک نظر ناموفق بود، URL صفحه را کپی کنید",
"showpost.comment.copylink.success": "لینک نظر کپی شد",
"showpost.comment.unknownhighlighted": "شناسهٔ نظر نامعتبر #{id}",
"showpost.commentinput.placeholder": "یک نظر بگذارید",
"showpost.copylink.success": "لینک کپی شد",
+ "showpost.loading": "",
"showpost.message.nodescription": "توضیحی ارائه نشده است.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "جستجوی پست اصلی...",
"showpost.responseform.message.mergedvotes": "رأی‌های این پست در پست اصلی ادغام می‌شود.",
"showpost.responseform.text.placeholder": "برنامهٔ خود را دربارهٔ این پست با کاربران در میان بگذارید...",
+ "showpost.save.success": "",
"signin.code.edit": "ویرایش",
"signin.code.getnew": "دریافت کد جدید",
"signin.code.instruction": "لطفا کدی که به <0>{email}</0> ارسال کردیم را وارد کنید.",
diff --git a/locale/fr/client.json b/locale/fr/client.json
index d4614ecfc..e1723a726 100644
--- a/locale/fr/client.json
+++ b/locale/fr/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Impossible de copier le lien du commentaire, veuillez copier l'URL de la page",
"showpost.comment.copylink.success": "Lien du commentaire copié dans le presse-papiers",
"showpost.comment.unknownhighlighted": "ID de commentaire #{id} invalide",
"showpost.commentinput.placeholder": "Rédiger un commentaire",
"showpost.copylink.success": "Lien copié dans le presse-papier",
+ "showpost.loading": "",
"showpost.message.nodescription": "Aucune description fournie.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Rechercher le message original...",
"showpost.responseform.message.mergedvotes": "Les votes de ce message seront fusionnés dans le message original.",
"showpost.responseform.text.placeholder": "Que se passe-t-il avec ce message ? Faites savoir à vos utilisateurs quels sont vos plans...",
+ "showpost.save.success": "",
"signin.code.edit": "Modifier",
"signin.code.getnew": "Obtenez un nouveau code",
"signin.code.instruction": "Veuillez saisir le code que nous venons d'envoyer à <0>{email}</0>",
diff --git a/locale/it/client.json b/locale/it/client.json
index 91961c17f..ed92099a0 100644
--- a/locale/it/client.json
+++ b/locale/it/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Impossibile copiare il collegamento al commento, copiare l'URL della pagina",
"showpost.comment.copylink.success": "Link al commento copiato negli appunti",
"showpost.comment.unknownhighlighted": "ID commento non valido #{id}",
"showpost.commentinput.placeholder": "Lascia un commento",
"showpost.copylink.success": "Collegamento copiato negli appunti",
+ "showpost.loading": "",
"showpost.message.nodescription": "Nessuna descrizione fornita.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Cerca post originale...",
"showpost.responseform.message.mergedvotes": "I voti di questo post saranno uniti al post originale.",
"showpost.responseform.text.placeholder": "Cosa succede con questo post? Fate sapere ai vostri utenti quali sono i vostri piani...",
+ "showpost.save.success": "",
"signin.code.edit": "Modificare",
"signin.code.getnew": "Ottieni un nuovo codice",
"signin.code.instruction": "Inserisci il codice che abbiamo appena inviato a <0>{email}</0>",
diff --git a/locale/ja/client.json b/locale/ja/client.json
index d82a4171d..7b4e04dbf 100644
--- a/locale/ja/client.json
+++ b/locale/ja/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "コメントリンクのコピーに失敗しました。ページURLをコピーしてください。",
"showpost.comment.copylink.success": "コメントリンクがクリップボードにコピーされました。",
"showpost.comment.unknownhighlighted": "無効なコメントID #{id}",
"showpost.commentinput.placeholder": "コメントを書く",
"showpost.copylink.success": "リンクをクリップボードにコピーしました",
+ "showpost.loading": "",
"showpost.message.nodescription": "詳細がありません。",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "オリジナルの投稿を検索...",
"showpost.responseform.message.mergedvotes": "この投稿からの投票は元の投稿にマージされます。",
"showpost.responseform.text.placeholder": "この記事はどうなっていますか? あなたのプランをユーザーに知らせてください...",
+ "showpost.save.success": "",
"signin.code.edit": "編集",
"signin.code.getnew": "新しいコードを取得する",
"signin.code.instruction": "<0>{email}</0> に送信したコードを入力してください。",
diff --git a/locale/nl/client.json b/locale/nl/client.json
index 8f85da765..7b780c6fe 100644
--- a/locale/nl/client.json
+++ b/locale/nl/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Het kopiëren van de commentaarlink is mislukt. Kopieer de URL van de pagina.",
"showpost.comment.copylink.success": "Reactielink gekopieerd naar klembord",
"showpost.comment.unknownhighlighted": "Ongeldige opmerking-ID #{id}",
"showpost.commentinput.placeholder": "Laat een reactie achter",
"showpost.copylink.success": "Link gekopieerd naar klembord",
+ "showpost.loading": "",
"showpost.message.nodescription": "Geen omschrijving opgegeven.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Zoek origineel bericht...",
"showpost.responseform.message.mergedvotes": "Stemmen van dit bericht zullen worden samengevoegd met het originele bericht.",
"showpost.responseform.text.placeholder": "Wat gebeurt er met dit bericht? Laat je gebruikers weten wat je plannen zijn...",
+ "showpost.save.success": "",
"signin.code.edit": "Bewerking",
"signin.code.getnew": "Ontvang een nieuwe code",
"signin.code.instruction": "Typ de code in die we zojuist naar <0>{email}</0> hebben gestuurd",
diff --git a/locale/pl/client.json b/locale/pl/client.json
index be3646e4c..bf8e5e2e9 100644
--- a/locale/pl/client.json
+++ b/locale/pl/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Nie udało się skopiować linku do komentarza, skopiuj adres URL strony",
"showpost.comment.copylink.success": "Link do komentarza skopiowano do schowka",
"showpost.comment.unknownhighlighted": "Nieprawidłowy identyfikator komentarza #{id}",
"showpost.commentinput.placeholder": "Skomentuj",
"showpost.copylink.success": "Link skopiowany do schowka",
+ "showpost.loading": "",
"showpost.message.nodescription": "Brak opisu.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Szukaj oryginalnego posta...",
"showpost.responseform.message.mergedvotes": "Głosy z tego posta zostaną scalone z oryginalnym postem.",
"showpost.responseform.text.placeholder": "Co się dzieje w temacie tego posta? Daj swoim użytkownikom znać o swoich planach...",
+ "showpost.save.success": "",
"signin.code.edit": "Redagować",
"signin.code.getnew": "Uzyskaj nowy kod",
"signin.code.instruction": "Proszę wpisać kod, który właśnie wysłaliśmy na adres <0>{email}</0>",
diff --git a/locale/pt-BR/client.json b/locale/pt-BR/client.json
index 046727e52..0e7feb022 100644
--- a/locale/pt-BR/client.json
+++ b/locale/pt-BR/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Falha ao copiar o link do comentário, copie a URL da página",
"showpost.comment.copylink.success": "Link do comentário copiado para área de transferência",
"showpost.comment.unknownhighlighted": "ID de comentário #{id} inválido",
"showpost.commentinput.placeholder": "Deixe um comentário",
"showpost.copylink.success": "Link copiado para a área de transferência",
+ "showpost.loading": "",
"showpost.message.nodescription": "Nenhuma descrição fornecida.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Procurar postagem original...",
"showpost.responseform.message.mergedvotes": "Votos desta publicação serão mesclados na postagem original.",
"showpost.responseform.text.placeholder": "O que está acontecendo com esta postagem? Informe seus usuários quais são os seus planos...",
+ "showpost.save.success": "",
"signin.code.edit": "Editar",
"signin.code.getnew": "Obtenha um novo código",
"signin.code.instruction": "Por favor, digite o código que acabamos de enviar para <0>{email}</0>",
diff --git a/locale/ru/client.json b/locale/ru/client.json
index ffd1615c3..6dbb12b8b 100644
--- a/locale/ru/client.json
+++ b/locale/ru/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Не удалось скопировать ссылку на комментарий, пожалуйста скопируйте URL страницы",
"showpost.comment.copylink.success": "Ссылка на комментарий скопирована в буфер",
"showpost.comment.unknownhighlighted": "Некорректный ID комментария #{id}",
"showpost.commentinput.placeholder": "Оставить комментарий",
"showpost.copylink.success": "Ссылка скопирована в буфер обмена",
+ "showpost.loading": "",
"showpost.message.nodescription": "Описания нет.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Выберите оригинальный пост...",
"showpost.responseform.message.mergedvotes": "Голоса этого поста будут прибавлены к голосам оригинального поста.",
"showpost.responseform.text.placeholder": "Что произойдёт с этим предложением? Дайте людям знать о ваших планах...",
+ "showpost.save.success": "",
"signin.code.edit": "Редактировать",
"signin.code.getnew": "Получить новый код",
"signin.code.instruction": "Пожалуйста, введите код, который мы только что отправили на номер <0>{email}</0>",
diff --git a/locale/sk/client.json b/locale/sk/client.json
index f5e44b986..4bc6cd851 100644
--- a/locale/sk/client.json
+++ b/locale/sk/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Nepodarilo sa skopírovať odkaz na komentár, prosím skopírujte URL adresu stránky",
"showpost.comment.copylink.success": "Odkaz na komentár skopírovaný do schránky",
"showpost.comment.unknownhighlighted": "Neplatné ID komentára #{id}",
"showpost.commentinput.placeholder": "Zanechať komentár",
"showpost.copylink.success": "Odkaz skopírovaný do schránky",
+ "showpost.loading": "",
"showpost.message.nodescription": "Nie je poskytnutý žiadny popis.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Hľadať pôvodný príspevok...",
"showpost.responseform.message.mergedvotes": "Hlasy z tohto príspevku budú zlúčené do pôvodného príspevku.",
"showpost.responseform.text.placeholder": "Čo sa deje s týmto príspevkom? Dajte svojim používateľom vedieť, aké máte plány...",
+ "showpost.save.success": "",
"signin.code.edit": "Upraviť",
"signin.code.getnew": "Získať nový kód",
"signin.code.instruction": "Zadajte kód, ktorý sme práve poslali na adresu <0>{email}</0>",
diff --git a/locale/sv-SE/client.json b/locale/sv-SE/client.json
index 8aa66a2c5..994f09ed4 100644
--- a/locale/sv-SE/client.json
+++ b/locale/sv-SE/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Misslyckades med att kopiera kommentarslänken, kopiera sidans URL",
"showpost.comment.copylink.success": "Kommentarlänk kopierad till urklipp",
"showpost.comment.unknownhighlighted": "Ogiltigt kommentar-ID #{id}",
"showpost.commentinput.placeholder": "Skriv en kommentar",
"showpost.copylink.success": "Länk kopierad till urklipp",
+ "showpost.loading": "",
"showpost.message.nodescription": "Ingen beskrivning angiven.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Sök i ursprungliga inlägget...",
"showpost.responseform.message.mergedvotes": "Röster från det här inlägget kommer att flyttas till det ursprungliga inlägget.",
"showpost.responseform.text.placeholder": "Vad händer med det här inlägget? Låt dina användare veta vad du planerar...",
+ "showpost.save.success": "",
"signin.code.edit": "Redigera",
"signin.code.getnew": "Skaffa en ny kod",
"signin.code.instruction": "Vänligen skriv in koden vi just skickade till <0>{email}</0>",
diff --git a/locale/tr/client.json b/locale/tr/client.json
index 1ec83d04c..09414eed9 100644
--- a/locale/tr/client.json
+++ b/locale/tr/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "Yorum bağlantısı kopyalanamadı, lütfen sayfa URL'sini kopyalayın",
"showpost.comment.copylink.success": "Yorum bağlantısı panoya kopyalandı",
"showpost.comment.unknownhighlighted": "Geçersiz yorum kimliği #{id}",
"showpost.commentinput.placeholder": "Yorum yazın",
"showpost.copylink.success": "Bağlantı panoya kopyalandı",
+ "showpost.loading": "",
"showpost.message.nodescription": "Herhangi bir açıklama belirtilmedi.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "Orijinal öneri ara...",
"showpost.responseform.message.mergedvotes": "Bu önerideki yorumlar orijinal öneriye dahil edilecek.",
"showpost.responseform.text.placeholder": "Bu öneriye neler oluyor? Kullanıcılara planlarınız hakkında bilgi verin...",
+ "showpost.save.success": "",
"signin.code.edit": "Düzenlemek",
"signin.code.getnew": "Yeni bir kod al",
"signin.code.instruction": "Lütfen az önce <0>{email}</0> adresine gönderdiğimiz kodu yazın",
diff --git a/locale/zh-CN/client.json b/locale/zh-CN/client.json
index 7ccb47a37..05ad3059f 100644
--- a/locale/zh-CN/client.json
+++ b/locale/zh-CN/client.json
@@ -181,11 +181,13 @@
"pagination.next": "",
"pagination.prev": "",
"post.pending": "",
+ "postdetails.backtoall": "",
"showpost.comment.copylink.error": "复制评论链接失败,请复制页面URL",
"showpost.comment.copylink.success": "评论链接已复制到剪贴板",
"showpost.comment.unknownhighlighted": "无效的评论ID #{id}",
"showpost.commentinput.placeholder": "发表评论",
"showpost.copylink.success": "链接已复制到剪贴板",
+ "showpost.loading": "",
"showpost.message.nodescription": "未提供描述.",
"showpost.moderation.admin.description": "",
"showpost.moderation.admin.title": "",
@@ -211,6 +213,7 @@
"showpost.postsearch.query.placeholder": "搜索原始帖子...",
"showpost.responseform.message.mergedvotes": "此帖子的投票将合并到原始帖子中.",
"showpost.responseform.text.placeholder": "这篇文章怎么了?让你的用户知道你的计划是什么...",
+ "showpost.save.success": "",
"signin.code.edit": "编辑",
"signin.code.getnew": "获取新代码",
"signin.code.instruction": "请输入我们刚刚发送到 <0>{email}</0> 的验证码",
diff --git a/public/components/PostDetails/PostDetails.tsx b/public/components/PostDetails/PostDetails.tsx
index f5e13f40f..8ebdadd36 100644
--- a/public/components/PostDetails/PostDetails.tsx
+++ b/public/components/PostDetails/PostDetails.tsx
@@ -10,20 +10,7 @@ import IconRSS from "@fider/assets/images/heroicons-rss.svg"
import IconPencil from "@fider/assets/images/heroicons-pencil-alt.svg"
import IconChat from "@fider/assets/images/heroicons-chat-alt-2.svg"
-import {
- ResponseDetails,
- Button,
- UserName,
- Moment,
- Markdown,
- Input,
- Form,
- Icon,
- Avatar,
- PoweredByFider,
- RSSModal,
- ResponseLozenge,
-} from "@fider/components"
+import { ResponseDetails, Button, UserName, Moment, Markdown, Input, Form, Icon, Avatar, PoweredByFider, RSSModal, ResponseLozenge } from "@fider/components"
import { CommentInput } from "@fider/pages/ShowPost/components/CommentInput"
import { ShowComment } from "@fider/pages/ShowPost/components/ShowComment"
import { VoteSection } from "@fider/pages/ShowPost/components/VoteSection"
@@ -46,6 +33,7 @@ import { FollowButton } from "@fider/pages/ShowPost/components/FollowButton"
interface PostDetailsProps {
postNumber: number
+ onDataChanged?: () => void
// Optional initial data for SSR
initialPost?: Post
initialSubscribed?: boolean
@@ -217,6 +205,7 @@ export const PostDetails: React.FC<PostDetailsProps> = (props) => {
description: newDescription,
})
notify.success(<Trans id="showpost.save.success">Post updated successfully</Trans>)
+ props.onDataChanged?.() // Notify parent that data changed
} else {
setError(result.error)
}
@@ -395,7 +384,7 @@ export const PostDetails: React.FC<PostDetailsProps> = (props) => {
{/* Vote Section */}
{!editMode && (
<div className="p-show-post__vote-section">
- <VoteSection post={post} votes={post.votesCount} />
+ <VoteSection post={post} votes={post.votesCount} onDataChanged={props.onDataChanged} />
</div>
)}
diff --git a/public/components/common/AvatarStack.tsx b/public/components/common/AvatarStack.tsx
index 841ba783f..53cea9edb 100644
--- a/public/components/common/AvatarStack.tsx
+++ b/public/components/common/AvatarStack.tsx
@@ -57,14 +57,7 @@ export const AvatarStack = (props: AvatarStackProps) => {
return (
<div className={classes}>
{props.users.map((x, i) => (
- <img
- key={i}
- className="c-avatar h-8 w-8"
- alt={x.name}
- src={`${x.avatarURL}?size=50`}
- onLoad={handleImageLoad}
- onError={handleImageError}
- />
+ <img key={i} className="c-avatar h-8 w-8" alt={x.name} src={`${x.avatarURL}?size=50`} onLoad={handleImageLoad} onError={handleImageError} />
))}
</div>
)
diff --git a/public/pages/Home/Home.page.tsx b/public/pages/Home/Home.page.tsx
index db5af0416..60bb792a8 100644
--- a/public/pages/Home/Home.page.tsx
+++ b/public/pages/Home/Home.page.tsx
@@ -3,7 +3,7 @@ import NoDataIllustration from "@fider/assets/images/undraw-no-data.svg"
import IconPlusCircle from "@fider/assets/images/heroicons-pluscircle.svg"
import IconArrowLeft from "@fider/assets/images/heroicons-arrowleft.svg"
-import React, { useEffect, useState } from "react"
+import React, { useEffect, useState, useRef } from "react"
import { Post, Tag, PostStatus } from "@fider/models"
import { Markdown, Hint, PoweredByFider, Icon, Header, Button } from "@fider/components"
import { PostsContainer } from "./components/PostsContainer"
@@ -49,9 +49,11 @@ const Lonely = () => {
const HomePage = (props: HomePageProps) => {
const fider = useFider()
+ const postsContainerRef = useRef<PostsContainer>(null)
const [isShareFeedbackOpen, setIsShareFeedbackOpen] = useState(isPostPending())
const [selectedPostId, setSelectedPostId] = useState<number | null>(null)
const [savedScrollPosition, setSavedScrollPosition] = useState<number>(0)
+ const [isPostDirty, setIsPostDirty] = useState(false)
useEffect(() => {
// If we're showing the share feedback, make sure we clear the show pending flag (for draft posts)
@@ -67,6 +69,8 @@ const HomePage = (props: HomePageProps) => {
// Save current scroll position
setSavedScrollPosition(window.scrollY)
setSelectedPostId(postNumber)
+ setLastOpenedPostId(postNumber) // Track which post was opened
+ setIsPostDirty(false) // Reset dirty flag when opening overlay
window.history.pushState({ selectedPostId: postNumber }, "", `/posts/${postNumber}/${slug}`)
}
@@ -74,22 +78,34 @@ const HomePage = (props: HomePageProps) => {
const handleCloseOverlay = () => {
setSelectedPostId(null)
window.history.pushState({}, "", "/")
- // Restore scroll position after state updates
- setTimeout(() => {
- window.scrollTo(0, savedScrollPosition)
- }, 0)
}
+ // Track which post was opened so we can update just that one
+ const [lastOpenedPostId, setLastOpenedPostId] = useState<number | null>(null)
+
+ // Update single post when closing overlay if data changed, and always restore scroll
+ useEffect(() => {
+ if (selectedPostId === null && lastOpenedPostId !== null) {
+ if (isPostDirty && postsContainerRef.current) {
+ postsContainerRef.current.updateSinglePost(lastOpenedPostId)
+ setIsPostDirty(false)
+ }
+ setLastOpenedPostId(null)
+
+ // Always restore scroll position when returning to home
+ setTimeout(() => {
+ window.scrollTo(0, savedScrollPosition)
+ }, 0)
+ }
+ }, [selectedPostId, lastOpenedPostId, isPostDirty, savedScrollPosition])
+
// Handle browser back/forward buttons
useEffect(() => {
const handlePopState = () => {
const path = window.location.pathname
if (path === "/" || path === "") {
setSelectedPostId(null)
- // Restore scroll position when going back to home
- setTimeout(() => {
- window.scrollTo(0, savedScrollPosition)
- }, 0)
+ // Scroll restoration is handled in the useEffect above
} else if (path.startsWith("/posts/")) {
// Save scroll position before opening post
setSavedScrollPosition(window.scrollY)
@@ -98,6 +114,7 @@ const HomePage = (props: HomePageProps) => {
if (match) {
const postNumber = parseInt(match[1], 10)
setSelectedPostId(postNumber)
+ setLastOpenedPostId(postNumber) // Track which post was opened
}
}
}
@@ -175,7 +192,9 @@ What can we do better? This is the place for you to vote, discuss and share idea
<div className="p-home__welcome-col">
<VStack spacing={6}>
<div>
- {fider.session.tenant.welcomeHeader && <h1 className="p-home__welcome-title mb-5">{parseWelcomeHeader(fider.session.tenant.welcomeHeader)}</h1>}
+ {fider.session.tenant.welcomeHeader && (
+ <h1 className="p-home__welcome-title mb-5">{parseWelcomeHeader(fider.session.tenant.welcomeHeader)}</h1>
+ )}
<Markdown className="p-home__welcome-body" text={fider.session.tenant.welcomeMessage || defaultWelcomeMessage} style="full" />
</div>
</VStack>
@@ -190,7 +209,17 @@ What can we do better? This is the place for you to vote, discuss and share idea
<span>{fider.session.tenant.invitation || defaultInvitation}</span>
</HStack>
</button>
- {isLonely() ? <Lonely /> : <PostsContainer posts={props.posts} tags={props.tags} countPerStatus={props.countPerStatus} onPostClick={handlePostClick} />}
+ {isLonely() ? (
+ <Lonely />
+ ) : (
+ <PostsContainer
+ ref={postsContainerRef}
+ posts={props.posts}
+ tags={props.tags}
+ countPerStatus={props.countPerStatus}
+ onPostClick={handlePostClick}
+ />
+ )}
<PoweredByFider slot="home-footer" className="lg:hidden xl:hidden mt-8" />
</div>
</div>
@@ -204,7 +233,7 @@ What can we do better? This is the place for you to vote, discuss and share idea
</span>
</HStack>
</Button>
- <PostDetails postNumber={selectedPostId} />
+ <PostDetails postNumber={selectedPostId} onDataChanged={() => setIsPostDirty(true)} />
</div>
)}
</div>
diff --git a/public/pages/Home/components/ListPosts.tsx b/public/pages/Home/components/ListPosts.tsx
index c24b459fa..8a04b1c2c 100644
--- a/public/pages/Home/components/ListPosts.tsx
+++ b/public/pages/Home/components/ListPosts.tsx
@@ -116,7 +116,12 @@ export const ListPosts = (props: ListPostsProps) => {
{minimalView ? (
<VStack spacing={2}>
{props.posts.map((post) => (
- <MinimalListPostItem key={post.id} post={post} tags={props.tags.filter((tag) => post.tags.indexOf(tag.slug) >= 0)} onPostClick={props.onPostClick} />
+ <MinimalListPostItem
+ key={post.id}
+ post={post}
+ tags={props.tags.filter((tag) => post.tags.indexOf(tag.slug) >= 0)}
+ onPostClick={props.onPostClick}
+ />
))}
</VStack>
) : (
diff --git a/public/pages/Home/components/PostsContainer.tsx b/public/pages/Home/components/PostsContainer.tsx
index 3a81eed01..1f98afdc1 100644
--- a/public/pages/Home/components/PostsContainer.tsx
+++ b/public/pages/Home/components/PostsContainer.tsx
@@ -123,6 +123,15 @@ export class PostsContainer extends React.Component<PostsContainerProps, PostsCo
}, 500)
}
+ public updateSinglePost = async (postNumber: number) => {
+ // Fetch the updated post and replace it in the array without changing order
+ const response = await actions.getPost(postNumber)
+ if (response.ok && this.state.posts) {
+ const updatedPosts = this.state.posts.map((post) => (post.number === postNumber ? response.data : post))
+ this.setState({ posts: updatedPosts })
+ }
+ }
+
private handleFilterChanged = (filterState: FilterState) => {
this.changeFilterCriteria({ filterState }, true)
}
diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsx
index 4dd6661b7..66decae29 100644
--- a/public/pages/ShowPost/ShowPost.page.tsx
+++ b/public/pages/ShowPost/ShowPost.page.tsx
@@ -16,7 +16,6 @@ interface ShowPostPageProps {
}
export default function ShowPostPage(props: ShowPostPageProps) {
-
return (
<>
<Header />
diff --git a/public/pages/ShowPost/components/VoteSection.tsx b/public/pages/ShowPost/components/VoteSection.tsx
index 65093d4e9..d021fd8e5 100644
--- a/public/pages/ShowPost/components/VoteSection.tsx
+++ b/public/pages/ShowPost/components/VoteSection.tsx
@@ -11,6 +11,7 @@ import { HStack, VStack } from "@fider/components/layout"
interface VoteSectionProps {
post: Post
votes: number
+ onDataChanged?: () => void
}
export const VoteSection = (props: VoteSectionProps) => {
@@ -30,6 +31,7 @@ export const VoteSection = (props: VoteSectionProps) => {
if (response.ok) {
setVotes(hasVoted ? votes - 1 : votes + 1)
setHasVoted(!hasVoted)
+ props.onDataChanged?.() // Notify parent that data changed
}
}
diff --git a/public/services/actions/post.ts b/public/services/actions/post.ts
index b4fd7bf8a..4fe5281c1 100644
--- a/public/services/actions/post.ts
+++ b/public/services/actions/post.ts
@@ -5,6 +5,10 @@ export const getAllPosts = async (): Promise<Result<Post[]>> => {
return await http.get<Post[]>("/api/v1/posts")
}
+export const getPost = async (postNumber: number): Promise<Result<Post>> => {
+ return await http.get<Post>(`/api/v1/posts/${postNumber}`)
+}
+
export interface SearchPostsParams {
query?: string
view?: string