fix(lightbox): hide comments toggle when allow_comments=false (#518)
@Rekoo-PS reported the MessageSquare comment button stayed visible in the lightbox toolbar even when guest comments were disabled. Same class of bug as #513 (per-photo Like button missing the master gate) but on a different control. The Like and Rating buttons in the lightbox toolbar gate correctly: feedbackEnabled && feedbackSettings?.allow_likes feedbackEnabled && feedbackSettings?.allow_ratings The MessageSquare button only checked feedbackEnabled. Since likes and ratings already have their own inline buttons in the same toolbar, this third button is effectively the "open comments panel" affordance — its badge counts comments, its tooltip mentions comments. When comments are off it has nothing meaningful to do. Add allow_comments to the local feedbackSettings type (the backend already returns it via galleryFeedback.js:33) and gate the button on feedbackEnabled && feedbackSettings?.allow_comments. Refs: #518
This commit is contained in:
@@ -77,6 +77,7 @@ export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
|
|||||||
feedback_enabled?: boolean;
|
feedback_enabled?: boolean;
|
||||||
allow_likes?: boolean;
|
allow_likes?: boolean;
|
||||||
allow_ratings?: boolean;
|
allow_ratings?: boolean;
|
||||||
|
allow_comments?: boolean;
|
||||||
require_name_email?: boolean;
|
require_name_email?: boolean;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
const [myLiked, setMyLiked] = useState<boolean>(false);
|
const [myLiked, setMyLiked] = useState<boolean>(false);
|
||||||
@@ -684,8 +685,12 @@ export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Feedback button with indicator */}
|
{/* Feedback button with indicator. Gated on allow_comments
|
||||||
{feedbackEnabled && (
|
because likes/ratings already have their own dedicated
|
||||||
|
toolbar buttons above — this MessageSquare button only
|
||||||
|
opens the comments panel, so it has nothing to do when
|
||||||
|
comments are off (#518). */}
|
||||||
|
{feedbackEnabled && feedbackSettings?.allow_comments && (
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowFeedback(!showFeedback);
|
setShowFeedback(!showFeedback);
|
||||||
|
|||||||
Reference in New Issue
Block a user