Personal anonymous flagging + "Field entry form" - doesn't remember flag because no session is started

Created on 10 May 2021, over 3 years ago

Problem/Motivation

When allowing anonymous users to create a personal flag, while using the "Field entry form" link type, the flagging status is not remembered for that user. It seems that the Flag module does not assure that a session has been created when using the "Field entry form", resulting in a session variable that gets destroyed immediately. As soon as the anonymous user refreshes, the flag-link is reset as if the user never used the flag.

Steps to reproduce

  • Create flag of type "personal", and link type "Field entry form"
  • Allow anonymous users to use this flag (flag and unflag)
  • Try flagging an entity using this flag and refreshing the page afterwards

Proposed resolution

The flag module should assure a session has been started when creating a flag via the field entry form. This could maybe be done in the "save" function of "FlaggingForm"?

The "flag" function of FlagService calls a function called "ensureSession" (also part of the FlagService), but the "Field entry form" link type never uses the FlagService, so the "ensureSession" function is never called.

Remaining tasks

  • Confirm that this is a bug
  • Determine the best way to fix this issue

User interface changes

None

API changes

Unknown

Data model changes

Unknown

🐛 Bug report
Status

Active

Version

4.0

Component

Flag core

Created by

🇧🇪Belgium gillesv

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