@@ -183,6 +183,16 @@ function sortRepliesWithPriority(
183183 return [ ...staffReplies , ...regularReplies ] ;
184184}
185185
186+ function callableErrorMessage ( error : unknown , fallback : string ) {
187+ if ( typeof error === "object" && error && "message" in error ) {
188+ const message = String ( ( error as { message : string } ) . message )
189+ . replace ( / ^ F i r e b a s e E r r o r : \s * / i, "" )
190+ . trim ( ) ;
191+ if ( message && ! / ^ ( i n t e r n a l | i n t e r n a l e r r o r ) $ / i. test ( message ) ) return message ;
192+ }
193+ return fallback ;
194+ }
195+
186196function ReaderAvatar ( {
187197 name,
188198 photoURL,
@@ -1282,7 +1292,7 @@ export default function CommentsSection({
12821292 } catch ( submitError ) {
12831293 await deleteMultipleCommentImagesSafe ( storage , uploadedImages ) ;
12841294 console . error ( "Unable to post comment:" , submitError ) ;
1285- setError ( "We could not post your comment. Please try again." ) ;
1295+ setError ( callableErrorMessage ( submitError , "We could not post your comment. Please try again." ) ) ;
12861296 } finally {
12871297 setBusyId ( null ) ;
12881298 }
@@ -1341,7 +1351,7 @@ export default function CommentsSection({
13411351 } catch ( replyError ) {
13421352 await deleteMultipleCommentImagesSafe ( storage , uploadedImages ) ;
13431353 console . error ( "Unable to post reply:" , replyError ) ;
1344- setError ( "We could not post your reply. Please try again." ) ;
1354+ setError ( callableErrorMessage ( replyError , "We could not post your reply. Please try again." ) ) ;
13451355 } finally {
13461356 setReplyBusyId ( null ) ;
13471357 }
@@ -1740,13 +1750,15 @@ export default function CommentsSection({
17401750 ) : ! authLoading && user && ! profile ?. handle ? (
17411751 < div className = "flex flex-wrap items-center justify-between gap-4 border-b border-white/30 py-7" >
17421752 < p className = "font-light text-white/70" >
1743- Choose your comment handle to participate in discussions.
1753+ { isStaff
1754+ ? "Set your team handle in the CMS before commenting."
1755+ : "Choose your comment handle to participate in discussions." }
17441756 </ p >
17451757 < Link
1746- href = "/ account"
1758+ href = { isStaff ? "https://cms.lap.onl/admin/profile" : "/ account"}
17471759 className = "group inline-flex items-center gap-3 font-semibold uppercase transition-colors duration-300 hover:text-[#8a2ae3] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-[#8a2ae3]"
17481760 >
1749- Claim your handle
1761+ { isStaff ? "Open CMS profile" : " Claim your handle" }
17501762 < RiArrowRightLine className = "text-2xl transition-transform duration-300 group-hover:translate-x-1" />
17511763 </ Link >
17521764 </ div >
0 commit comments