Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#5866 closed defect (bug) (fixed)

On Trac only run capital P dangit JS on description and summary for new tickets.

Reported by: peterwilsoncc's profile peterwilsoncc Owned by: dd32's profile dd32
Milestone: Priority: normal
Component: Trac Keywords: needs-dev-note


WordPress trac runs a JavaScript version of capital_P_dangit() on a ticket's summary, description and comment fields located in wp-trac.js#L545 at the time of writing.

If the JavaScript fails to run when a ticket is created, replying to the ticket will cause the summary and description to be edited and credited to the author of the reply. An example of this is #core51904 when I changed the status in comment 3.

This can have the effect of making the author of the comment appear unwelcoming to the contributor, without the comment author having any such intent.

It would be lovely if the function only ran on the summary and description field on new tickets, rather than when making a reply. This can be done by modifying the selectors for the description and summary fields

Based on some browser console testing, changing the selectors as follows should prevent unintended edits:

-var $summary     = $( '#field-summary' ),
+var $summary     = $( '#field-summary' ).not( '#ticket ~ #propertyform #field-summary' ),
-    $description = $( '#field-description' ),
+    $description = $( '#field-description' ).not( '#ticket ~ #propertyform #field-description' ),
     $comment     = $( '#comment' );

Change History (4)

This ticket was mentioned in Slack in #meta by peterwilsoncc. View the logs.

3 years ago

#2 @dd32
3 years ago

  • Component changed from General to Trac

#3 @dd32
2 years ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 11539:

Trac: Don't alter the reporters ticket description/summary when a Gardener comments/edits a field.

Fixes #5866.

#4 @dd32
2 years ago

  • Keywords needs-dev-note added
Note: See TracTickets for help on using tickets.