mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 18:52:56 +00:00
dev day #79
This commit is contained in:
@@ -272,9 +272,13 @@ const PollLinker: React.FC<PollLinkerProps> = ({ articleId, eventId, onPollsChan
|
||||
}));
|
||||
};
|
||||
|
||||
// Filter out polls that are already linked
|
||||
// Filter out polls that are already linked elsewhere to avoid accidental reuse
|
||||
const linkedPollIds = new Set(linkedPolls?.map(p => p.id) || []);
|
||||
const availablePolls = allPolls?.filter(p => !linkedPollIds.has(p.id)) || [];
|
||||
const availablePolls = allPolls?.filter(p => {
|
||||
if (linkedPollIds.has(p.id)) return false; // already linked to this content, handled above
|
||||
const linkedElsewhere = !!(p.related_article_id || p.related_event_id || p.related_match_id || p.related_video_url);
|
||||
return !linkedElsewhere;
|
||||
}) || [];
|
||||
|
||||
if (!articleId && !eventId) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user