TypeError in FlagCountManager when flaggable no longer exists

Created on 6 April 2021, almost 4 years ago
Updated 25 August 2024, 5 months ago

Problem/Motivation

When deleting a flag that is associated with a flaggable that no longer exists, FlagCountManager will try and pass a NULL item into resetLoadedCounts, which is rejected as a TypeError.

Steps to reproduce

Not sure how this cropped up, although I expect it can be reproduced like this:

Create a content type
Create a flag that can be used to flag the content type
Create a content item of the new tyoe
Flag the content item
Delete the content item
Delete the flagging in code; load the flag, call ->delete() on it

Proposed resolution

Check whether the flaggable still exists before passing it into resetLoadedCounts().

Remaining tasks

Create MR
Review
Commit

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Closed: duplicate

Component

Flag core

Created by

πŸ‡³πŸ‡±Netherlands eelkeblok Netherlands πŸ‡³πŸ‡±

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024