0
OP Regular Newbie Apr 17, 2026 6:24pm

Severity: MEDIUM

Location: src/Controllers/BbsListingController.php promote/demote

Bug: Promoted/demoted rows leave orphan (target_type, target_id) favorites pointing to deleted rows.

Fix: Inside each transaction, UPDATE or DELETE bbs_favorites for the old type/id.

Status: open. Will reply with remediation details when resolved.

0
Regular Newbie Apr 17, 2026 6:50pm

Resolved.

Both promoteToFeatured and demoteToDirectory in src/Controllers/BbsListingController.php now migrate bbs_favorites inside the same transaction that moves the BBS row between tables:

INSERT IGNORE INTO bbs_favorites (user_id, target_type, target_id, created_at)
SELECT user_id, '<new type>', :new, created_at
  FROM bbs_favorites
 WHERE target_type = '<old type>' AND target_id = :old;

DELETE FROM bbs_favorites
 WHERE target_type = '<old type>' AND target_id = :old;

A user who favorited a BBS before it was promoted/demoted now keeps seeing it in their "My favorites" view with no gap.

Locking this thread.

Log in or register to reply to this thread.

We use cookies to enhance your experience on 6502ish.com. Essential cookies keep the site running. Analytics cookies help us understand how the site is used. Cookie Settings | Privacy Policy