feat(post form): add rules and FAQ prompt

This commit is contained in:
Tommaso Casaburi
2026-05-21 18:55:36 +07:00
parent 5fc27fda21
commit 7305e40870
38 changed files with 171 additions and 42 deletions
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "تجاهل",
"board_address_unverified_warning": "لم يتم التحقق من عنوان هذه اللوحة. قد لا يكون مالك اللوحة مالكًا لهذا العنوان.",
"go_to_settings_to_import_mod_account": "انتقل إلى <1>الإعدادات</1> لاستيراد حساب المشرف الخاص بك"
"go_to_settings_to_import_mod_account": "انتقل إلى <1>الإعدادات</1> لاستيراد حساب المشرف الخاص بك",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "উপেক্ষা করুন",
"board_address_unverified_warning": "এই বোর্ড ঠিকানাটি যাচাই করা হয়নি। বোর্ডের মালিক এই ঠিকানার মালিক নাও হতে পারেন।",
"go_to_settings_to_import_mod_account": "আপনার মড অ্যাকাউন্ট আমদানি করতে <1>সেটিংস</1>-এ যান"
"go_to_settings_to_import_mod_account": "আপনার মড অ্যাকাউন্ট আমদানি করতে <1>সেটিংস</1>-এ যান",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Ignorovat",
"board_address_unverified_warning": "Tato adresa nástěnky není ověřená. Vlastník nástěnky nemusí tuto adresu vlastnit.",
"go_to_settings_to_import_mod_account": "Přejděte do <1>nastavení</1> a importujte svůj moderátorský účet"
"go_to_settings_to_import_mod_account": "Přejděte do <1>nastavení</1> a importujte svůj moderátorský účet",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Ignorer",
"board_address_unverified_warning": "Denne boardadresse er ikke verificeret. Boardets ejer ejer muligvis ikke denne adresse.",
"go_to_settings_to_import_mod_account": "Gå til <1>indstillinger</1> for at importere din mod-konto"
"go_to_settings_to_import_mod_account": "Gå til <1>indstillinger</1> for at importere din mod-konto",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Ignorieren",
"board_address_unverified_warning": "Diese Board-Adresse ist nicht verifiziert. Der Board-Betreiber besitzt diese Adresse möglicherweise nicht.",
"go_to_settings_to_import_mod_account": "Gehe zu <1>Einstellungen</1>, um dein Moderatorkonto zu importieren"
"go_to_settings_to_import_mod_account": "Gehe zu <1>Einstellungen</1>, um dein Moderatorkonto zu importieren",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Παράβλεψη",
"board_address_unverified_warning": "Αυτή η διεύθυνση board δεν έχει επαληθευτεί. Ο ιδιοκτήτης του board ενδέχεται να μην κατέχει αυτή τη διεύθυνση.",
"go_to_settings_to_import_mod_account": "Μεταβείτε στις <1>ρυθμίσεις</1> για να εισαγάγετε τον λογαριασμό διαχειριστή σας"
"go_to_settings_to_import_mod_account": "Μεταβείτε στις <1>ρυθμίσεις</1> για να εισαγάγετε τον λογαριασμό διαχειριστή σας",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -409,5 +409,6 @@
"media_failed_to_load_inline_unknown": "External image failed. Try VPN.",
"directory_status_unavailable_reason": "check only available for top 5 boards",
"modQueue.dismiss": "Dismiss",
"board_address_unverified_warning": "This board address is not verified. The board owner might not own this address."
"board_address_unverified_warning": "This board address is not verified. The board owner might not own this address.",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Descartar",
"board_address_unverified_warning": "Esta dirección del tablón no está verificada. Es posible que el propietario del tablón no sea dueño de esta dirección.",
"go_to_settings_to_import_mod_account": "Ve a <1>configuración</1> para importar tu cuenta de moderador"
"go_to_settings_to_import_mod_account": "Ve a <1>configuración</1> para importar tu cuenta de moderador",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "نادیده گرفتن",
"board_address_unverified_warning": "این نشانی برد تأیید نشده است. ممکن است مالک برد صاحب این نشانی نباشد.",
"go_to_settings_to_import_mod_account": "برای وارد کردن حساب مدیر خود به <1>تنظیمات</1> بروید"
"go_to_settings_to_import_mod_account": "برای وارد کردن حساب مدیر خود به <1>تنظیمات</1> بروید",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Ohita",
"board_address_unverified_warning": "Tätä laudan osoitetta ei ole vahvistettu. Laudan omistaja ei välttämättä omista tätä osoitetta.",
"go_to_settings_to_import_mod_account": "Siirry <1>asetuksiin</1> tuodaksesi moderaattoritilisi"
"go_to_settings_to_import_mod_account": "Siirry <1>asetuksiin</1> tuodaksesi moderaattoritilisi",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Huwag pansinin",
"board_address_unverified_warning": "Hindi beripikado ang address ng board na ito. Maaaring hindi pag-aari ng may-ari ng board ang address na ito.",
"go_to_settings_to_import_mod_account": "Pumunta sa <1>mga setting</1> para i-import ang iyong mod account"
"go_to_settings_to_import_mod_account": "Pumunta sa <1>mga setting</1> para i-import ang iyong mod account",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Ignorer",
"board_address_unverified_warning": "Cette adresse de board n'est pas vérifiée. Le propriétaire du board pourrait ne pas posséder cette adresse.",
"go_to_settings_to_import_mod_account": "Allez dans les <1>paramètres</1> pour importer votre compte de modération"
"go_to_settings_to_import_mod_account": "Allez dans les <1>paramètres</1> pour importer votre compte de modération",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "התעלם",
"board_address_unverified_warning": "כתובת הלוח הזו אינה מאומתת. ייתכן שבעל הלוח אינו הבעלים של הכתובת הזו.",
"go_to_settings_to_import_mod_account": "עבור אל <1>הגדרות</1> כדי לייבא את חשבון המוד שלך"
"go_to_settings_to_import_mod_account": "עבור אל <1>הגדרות</1> כדי לייבא את חשבון המוד שלך",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "अनदेखा करें",
"board_address_unverified_warning": "इस बोर्ड पते की पुष्टि नहीं हुई है। हो सकता है बोर्ड का मालिक इस पते का मालिक न हो।",
"go_to_settings_to_import_mod_account": "अपना मॉड खाता इम्पोर्ट करने के लिए <1>सेटिंग्स</1> पर जाएं"
"go_to_settings_to_import_mod_account": "अपना मॉड खाता इम्पोर्ट करने के लिए <1>सेटिंग्स</1> पर जाएं",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Mellőzés",
"board_address_unverified_warning": "Ez a board-cím nincs ellenőrizve. Lehet, hogy a board tulajdonosa nem birtokolja ezt a címet.",
"go_to_settings_to_import_mod_account": "Lépj a <1>beállítások</1> menübe a moderátori fiókod importálásához"
"go_to_settings_to_import_mod_account": "Lépj a <1>beállítások</1> menübe a moderátori fiókod importálásához",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Abaikan",
"board_address_unverified_warning": "Alamat board ini belum diverifikasi. Pemilik board mungkin tidak memiliki alamat ini.",
"go_to_settings_to_import_mod_account": "Buka <1>pengaturan</1> untuk mengimpor akun mod Anda"
"go_to_settings_to_import_mod_account": "Buka <1>pengaturan</1> untuk mengimpor akun mod Anda",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Ignora",
"board_address_unverified_warning": "Questo indirizzo della board non è verificato. Il proprietario della board potrebbe non possedere questo indirizzo.",
"go_to_settings_to_import_mod_account": "Vai alle <1>impostazioni</1> per importare il tuo account mod"
"go_to_settings_to_import_mod_account": "Vai alle <1>impostazioni</1> per importare il tuo account mod",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "無視",
"board_address_unverified_warning": "このボードアドレスは検証されていません。ボード所有者がこのアドレスを所有していない可能性があります。",
"go_to_settings_to_import_mod_account": "モデレーターアカウントをインポートするには<1>設定</1>に移動してください"
"go_to_settings_to_import_mod_account": "モデレーターアカウントをインポートするには<1>設定</1>に移動してください",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "무시",
"board_address_unverified_warning": "이 보드 주소는 확인되지 않았습니다. 보드 소유자가 이 주소를 소유하지 않았을 수 있습니다.",
"go_to_settings_to_import_mod_account": "관리자 계정을 가져오려면 <1>설정</1>으로 이동하세요"
"go_to_settings_to_import_mod_account": "관리자 계정을 가져오려면 <1>설정</1>으로 이동하세요",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "दुर्लक्ष करा",
"board_address_unverified_warning": "हा बोर्ड पत्ता सत्यापित केलेला नाही. बोर्डचा मालक हा पत्ता मालक नसू शकतो.",
"go_to_settings_to_import_mod_account": "तुमचे मॉड खाते आयात करण्यासाठी <1>सेटिंग्ज</1> वर जा"
"go_to_settings_to_import_mod_account": "तुमचे मॉड खाते आयात करण्यासाठी <1>सेटिंग्ज</1> वर जा",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Negeren",
"board_address_unverified_warning": "Dit boardadres is niet geverifieerd. De eigenaar van het board is mogelijk niet de eigenaar van dit adres.",
"go_to_settings_to_import_mod_account": "Ga naar <1>instellingen</1> om je mod-account te importeren"
"go_to_settings_to_import_mod_account": "Ga naar <1>instellingen</1> om je mod-account te importeren",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Ignorer",
"board_address_unverified_warning": "Denne board-adressen er ikke bekreftet. Board-eieren eier kanskje ikke denne adressen.",
"go_to_settings_to_import_mod_account": "Gå til <1>innstillinger</1> for å importere modkontoen din"
"go_to_settings_to_import_mod_account": "Gå til <1>innstillinger</1> for å importere modkontoen din",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Pomiń",
"board_address_unverified_warning": "Ten adres boarda nie jest zweryfikowany. Właściciel boarda może nie być właścicielem tego adresu.",
"go_to_settings_to_import_mod_account": "Przejdź do <1>ustawień</1>, aby zaimportować swoje konto moderatora"
"go_to_settings_to_import_mod_account": "Przejdź do <1>ustawień</1>, aby zaimportować swoje konto moderatora",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Ignorar",
"board_address_unverified_warning": "Este endereço do board não foi verificado. O proprietário do board pode não ser dono deste endereço.",
"go_to_settings_to_import_mod_account": "Vá para <1>configurações</1> para importar sua conta de mod"
"go_to_settings_to_import_mod_account": "Vá para <1>configurações</1> para importar sua conta de mod",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Ignoră",
"board_address_unverified_warning": "Această adresă de board nu este verificată. Proprietarul boardului s-ar putea să nu dețină această adresă.",
"go_to_settings_to_import_mod_account": "Accesează <1>setările</1> pentru a importa contul tău de moderator"
"go_to_settings_to_import_mod_account": "Accesează <1>setările</1> pentru a importa contul tău de moderator",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Скрыть",
"board_address_unverified_warning": "Этот адрес доски не проверен. Владелец доски может не владеть этим адресом.",
"go_to_settings_to_import_mod_account": "Перейдите в <1>настройки</1>, чтобы импортировать свой аккаунт модератора"
"go_to_settings_to_import_mod_account": "Перейдите в <1>настройки</1>, чтобы импортировать свой аккаунт модератора",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Shpërfill",
"board_address_unverified_warning": "Kjo adresë e board-it nuk është verifikuar. Pronari i board-it mund të mos e zotërojë këtë adresë.",
"go_to_settings_to_import_mod_account": "Shkoni te <1>parametrat</1> për të importuar llogarinë tuaj të modit"
"go_to_settings_to_import_mod_account": "Shkoni te <1>parametrat</1> për të importuar llogarinë tuaj të modit",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Avfärda",
"board_address_unverified_warning": "Den här board-adressen är inte verifierad. Boardets ägare kanske inte äger den här adressen.",
"go_to_settings_to_import_mod_account": "Gå till <1>inställningar</1> för att importera ditt modkonto"
"go_to_settings_to_import_mod_account": "Gå till <1>inställningar</1> för att importera ditt modkonto",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "విస్మరించు",
"board_address_unverified_warning": "ఈ బోర్డ్ చిరునామా ధృవీకరించబడలేదు. బోర్డ్ యజమాని ఈ చిరునామాకు యజమాని కాకపోవచ్చు.",
"go_to_settings_to_import_mod_account": "మీ మోడ్ ఖాతాను దిగుమతి చేయడానికి <1>అమరికలు</1>కి వెళ్లండి"
"go_to_settings_to_import_mod_account": "మీ మోడ్ ఖాతాను దిగుమతి చేయడానికి <1>అమరికలు</1>కి వెళ్లండి",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "มองข้าม",
"board_address_unverified_warning": "ที่อยู่บอร์ดนี้ยังไม่ได้รับการยืนยัน เจ้าของบอร์ดอาจไม่ได้เป็นเจ้าของที่อยู่นี้",
"go_to_settings_to_import_mod_account": "ไปที่ <1>การตั้งค่า</1> เพื่อนำเข้าบัญชีผู้ดูแลของคุณ"
"go_to_settings_to_import_mod_account": "ไปที่ <1>การตั้งค่า</1> เพื่อนำเข้าบัญชีผู้ดูแลของคุณ",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Yoksay",
"board_address_unverified_warning": "Bu board adresi doğrulanmamış. Board sahibi bu adresin sahibi olmayabilir.",
"go_to_settings_to_import_mod_account": "Mod hesabınızı içe aktarmak için <1>ayarlar</1>a gidin"
"go_to_settings_to_import_mod_account": "Mod hesabınızı içe aktarmak için <1>ayarlar</1>a gidin",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Приховати",
"board_address_unverified_warning": "Цю адресу дошки не перевірено. Власник дошки може не володіти цією адресою.",
"go_to_settings_to_import_mod_account": "Перейдіть до <1>налаштувань</1>, щоб імпортувати свій обліковий запис модератора"
"go_to_settings_to_import_mod_account": "Перейдіть до <1>налаштувань</1>, щоб імпортувати свій обліковий запис модератора",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "نظر انداز کریں",
"board_address_unverified_warning": "اس بورڈ کے پتے کی تصدیق نہیں ہوئی۔ ممکن ہے بورڈ کا مالک اس پتے کا مالک نہ ہو۔",
"go_to_settings_to_import_mod_account": "اپنا موڈ اکاؤنٹ درآمد کرنے کے لیے <1>ترتیبات</1> پر جائیں"
"go_to_settings_to_import_mod_account": "اپنا موڈ اکاؤنٹ درآمد کرنے کے لیے <1>ترتیبات</1> پر جائیں",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "Bỏ qua",
"board_address_unverified_warning": "Địa chỉ bảng này chưa được xác minh. Chủ bảng có thể không sở hữu địa chỉ này.",
"go_to_settings_to_import_mod_account": "Vào <1>cài đặt</1> để nhập tài khoản mod của bạn"
"go_to_settings_to_import_mod_account": "Vào <1>cài đặt</1> để nhập tài khoản mod của bạn",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
+2 -1
View File
@@ -390,5 +390,6 @@
"nothing_found": "Nothing Found",
"modQueue.dismiss": "忽略",
"board_address_unverified_warning": "此版面地址尚未验证。版主可能并不拥有此地址。",
"go_to_settings_to_import_mod_account": "前往<1>设置</1>以导入您的版主账户"
"go_to_settings_to_import_mod_account": "前往<1>设置</1>以导入您的版主账户",
"post_form_rules_faq_prompt": "Please read the <rules>Rules</rules> and <faq>FAQ</faq> before posting."
}
@@ -53,11 +53,30 @@ const testState = vi.hoisted(() => ({
uploadedFileName: 'picked.png' as string | null,
}));
vi.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key: string, options?: Record<string, unknown>) => (options?.domain ? `${key}:${options.domain}` : key),
}),
}));
vi.mock('react-i18next', async () => {
const React = await vi.importActual<typeof import('react')>('react');
return {
Trans: ({ i18nKey, components }: { components?: Record<string, React.ReactElement>; i18nKey: string }) => {
if (i18nKey === 'post_form_rules_faq_prompt') {
return React.createElement(
React.Fragment,
{},
'Please read the ',
components?.rules ? React.cloneElement(components.rules, {}, 'Rules') : 'Rules',
' and ',
components?.faq ? React.cloneElement(components.faq, {}, 'FAQ') : 'FAQ',
' before posting.',
);
}
return i18nKey;
},
useTranslation: () => ({
t: (key: string, options?: Record<string, unknown>) => (options?.domain ? `${key}:${options.domain}` : key),
}),
};
});
vi.mock('react-router-dom', async () => {
const actual = await vi.importActual<typeof import('react-router-dom')>('react-router-dom');
@@ -643,6 +662,27 @@ describe('PostForm', () => {
expect(table?.textContent).toContain('file name.jpg');
});
it('shows the rules and FAQ prompt below the file row with a board-specific rules link', async () => {
testState.resolvedCommunityAddress = 'music-posting.eth';
await renderPostForm('/mu');
await clickByText(container, 'start_new_thread');
const table = container.querySelector('table');
const rows = Array.from(table?.querySelectorAll('tr') || []);
const fileRowIndex = rows.findIndex((row) => row.querySelector('td')?.textContent === 'file');
const promptRowIndex = rows.findIndex((row) => row.textContent === 'Please read the Rules and FAQ before posting.');
const promptRow = rows[promptRowIndex];
const links = Array.from(promptRow?.querySelectorAll('a') || []);
expect(fileRowIndex).toBeGreaterThan(-1);
expect(promptRowIndex).toBe(fileRowIndex + 1);
expect(promptRow?.className).toBe('rules');
expect(promptRow?.querySelector('ul')?.className).toBe('rules');
expect(links.map((link) => link.textContent)).toEqual(['Rules', 'FAQ']);
expect(links.map((link) => link.getAttribute('href'))).toEqual(['/rules/mu', '/faq']);
});
it('shortens long pasted file-link filenames next to the upload button', async () => {
testState.uploadedFileName = null;
@@ -182,6 +182,40 @@
font-weight: normal;
}
.postFormTable :global(ul.rules) {
margin: 0px;
padding: 0px;
margin-top: 5px;
}
.postFormTable :global(ul.rules > li) {
list-style: none;
font-size: 11px;
}
.postFormTable :global(.rules > li::before) {
content: "\2022 \20";
}
.postFormTable :global(tr.rules td) {
border: 0px !important;
background-color: transparent !important;
font-weight: normal !important;
text-transform: none !important;
}
.postFormTable :global(tr.rules a),
.postFormTable :global(tr.rules a:visited) {
color: var(--post-link-text-color);
text-decoration: none;
}
.postFormTable :global(tr.rules a:hover),
.postFormTable :global(tr.rules a:visited:hover) {
color: var(--post-link-text-color-hover);
text-decoration: none;
}
.error {
font-weight: bold;
padding: 5px;
+22 -2
View File
@@ -1,7 +1,7 @@
import { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Trans, useTranslation } from 'react-i18next';
import type { TFunction } from 'i18next';
import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { Link, useLocation, useNavigate, useParams } from 'react-router-dom';
import { Comment, setAccount, useAccount, useEditedComment } from '@bitsocial/bitsocial-react-hooks';
import getShortAddress from '../../lib/get-short-address';
import useCommunitiesPagesStore from '@bitsocial/bitsocial-react-hooks/dist/stores/communities-pages';
@@ -10,6 +10,7 @@ import { getExpiringMediaLinkAlert } from '../../lib/utils/media-link-validation
import { truncateWithEllipsisInMiddle } from '../../lib/utils/string-utils';
import { getPublishURLFilename, isValidPublishURL, isValidURL } from '../../lib/utils/url-utils';
import { hasModQueueAccessRole } from '../../lib/utils/mod-access';
import { getBoardPath } from '../../lib/utils/route-utils';
import { isAllView, isCatalogView, isModQueueView, isModView, isPostPageView, isSubscriptionsView } from '../../lib/utils/view-utils';
import { useAccountCommunityAddresses } from '../../hooks/use-account-community-addresses';
import { useDirectories, useDirectoryByAddress } from '../../hooks/use-directories';
@@ -132,6 +133,7 @@ interface PostFormFieldsProps {
accountCommunityAddresses: string[];
subscriptions: string[];
communityAddress: string | undefined;
rulesPath: string;
requirePostLinkIsMedia: boolean;
showBbcodeToolbar: boolean;
onBbcodePreviewToggle: () => void;
@@ -171,6 +173,7 @@ const PostFormFields = ({
accountCommunityAddresses,
subscriptions,
communityAddress,
rulesPath,
requirePostLinkIsMedia,
showBbcodeToolbar,
onBbcodePreviewToggle,
@@ -313,6 +316,21 @@ const PostFormFields = ({
</td>
</tr>
)}
<tr className='rules'>
<td colSpan={2}>
<ul className='rules'>
<li>
<Trans
i18nKey='post_form_rules_faq_prompt'
components={{
rules: <Link to={rulesPath} />,
faq: <Link to='/faq' />,
}}
/>
</li>
</ul>
</td>
</tr>
{((isInPostView && showSpoilerForReply) || (!isInPostView && showSpoilerForPost)) && (
<tr className={styles.spoilerButton}>
<td>{t('options')}</td>
@@ -388,6 +406,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
const subscriptions = account?.subscriptions || [];
const directories = useDirectories();
const directoryEntry = useDirectoryByAddress(effectiveBoardAddress);
const rulesPath = effectiveBoardAddress ? `/rules/${getBoardPath(effectiveBoardAddress, directories)}` : '/rules';
const showSpoilerForPost = directoryEntry?.features?.noSpoilers !== true;
const showSpoilerForReply = directoryEntry?.features?.noSpoilerReplies !== true;
const requirePostLinkIsMediaFeature = directoryEntry?.features?.requirePostLinkIsMedia;
@@ -621,6 +640,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
accountCommunityAddresses={accountCommunityAddresses}
subscriptions={subscriptions}
communityAddress={communityAddress}
rulesPath={rulesPath}
requirePostLinkIsMedia={requirePostLinkIsMedia}
showBbcodeToolbar={showBbcodeToolbar}
onBbcodePreviewToggle={handleBbcodePreviewToggle}