CommentForm selects using the user formatted name

Created on 21 September 2015, over 9 years ago
Updated 16 February 2025, 8 days ago

Problem/Motivation

Blocks #2559971: Make SafeMarkup::format() return a safe string object to remove reliance on a static, unpredictable safe list β†’

CommentForm does a loadByProperties using the formatted username. This is nonsense. In fact much of the code involved with previewing comments and comment forms is based on extremely old code that is no longer need.

This patch will changes the way an admin can edit the name of the user who makes the comment. In HEAD we have a single field that is switched to do different things in different situations:

  • Anonymous user on the comment add form or comment preview it is a free text field for the anon user to provide a name
  • Logged in user on the comment add form or comment preview it is a item field that displays the name to the user (this is unnecessary the user knows their name and makes the form basically uncacheable)
  • Comment admin whilst editing someone else's comment - it is an entity reference autocomplete field

Proposed resolution

Remove all the old unnecessary code... and bring some sanity to the form and make it cacheable:

  • A free text field to allow anon's to add provide their name - this field is not displayed to logged in users and is displayed to comment admins when editing
  • No username is displayed to logged in users in the comment add form or preview.
  • Comments admins are displayed a new entity reference field so they can change the owner of a comment

Remaining tasks

Review
Commit

User interface changes

For a logged in user they no longer have their name displayed in the comment form.

API changes

None

Data model changes

None

πŸ“Œ Task
Status

Fixed

Version

8.0 ⚰️

Component

comment.module

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

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