Prevent the user flag computed fields crashes with anonymous users

Created on 10 August 2021, over 3 years ago
Updated 23 July 2024, 5 months ago

Problem/Motivation

The flag module throws exceptions when the user requesting the flags is an anonymous user:

This makes these 2 computed fields works only when the user is authenticated.

Steps to reproduce

Go to a JSON API endpoint that uses some of these computed fields with an anonymous user.

Proposed resolution

Capture the exceptions, and return empty values in the computed fields in these cases.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain omarlopesino

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