Page MenuHomePhorge

Warn in comment field if task is closed as duplicate
Needs ReviewPublic

Authored by aklapper on Feb 29 2024, 17:07.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 20:09
Unknown Object (File)
Fri, Apr 26, 20:09
Unknown Object (File)
Fri, Apr 26, 20:09
Unknown Object (File)
Thu, Apr 25, 22:48
Unknown Object (File)
Thu, Apr 25, 12:46
Unknown Object (File)
Sun, Apr 21, 08:07
Unknown Object (File)
Wed, Apr 17, 18:24
Unknown Object (File)
Wed, Apr 17, 07:04

Details

Summary

Display a placeholder text in the text comment field of a Maniphest task if the task status has been set to Duplicate.
This makes it clearer to users (who may have not checked the task status at the top of the page) not to fragment conversations.

Closes T15749

Test Plan
  • Be logged in and go to a task which is closed as a duplicate and see the placeholder text in the field to add a comment.
  • Be logged in and go to tasks which are not closed as a duplicate and see no placeholder text in the field to add a comment.

Diff Detail

Repository
rP Phorge
Branch
warnDuplicate (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1157
Build 1157: arc lint + arc unit

Event Timeline

I like the result. Do you also think that the phrase is probably a bit too much in serious business mode? 🤔 Any idea about how to make it a bit more soft?

Anyway maybe we can wrap in pht('...')

I also don't get if in this part we have access to any thing related to Maniphest, ManiphestEditEngine or this kind of stuff, to just call $something->getCommentPanelPlaceholder() and have the business logic there in the specific application itself.

This revision is now accepted and ready to land.Feb 29 2024, 20:13
src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
304

Have you already tried this?

I also don't get if in this part we have access to any thing related to Maniphest, ManiphestEditEngine or this kind of stuff, to just call $something->getCommentPanelPlaceholder() and have the business logic there in the specific application itself.

I fail to find anything in https://we.phorge.it/source/phorge/browse/master/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php which would allow us to know in which Phorge application this comment field is rendered :(

I also don't get if in this part we have access to any thing related to Maniphest, ManiphestEditEngine or this kind of stuff, to just call $something->getCommentPanelPlaceholder() and have the business logic there in the specific application itself.

Yeah, let me refactor this. It'll be more lines of code but way cleaner and expandable.

I see quite some potential in our downstream instance where folks do not get exposed to hints in a Form Preamble when commenting on an existing task, and will not always find and read hints in a custom red box manually added to a task description either, while this comment field placeholder will be nice automated server-side logic.

Abstract logic: Move application specific conditions to display a comment field placeholder text into the corresponding EditEngine of the object that the comment field is displayed in, by defining a public getCommentFieldPlaceholderText() function.

Once acceptable, this patch should likely be split into two separate patches: One for the general placeholder display functionality in PhabricatorApplicationTransactionCommentView, one for application-specific conditions and placeholder string (in this use case, ManiphestEditEngine for tasks).

Test by going to a task closed as a duplicate and looking at the comment field. Also test by replacing the final return ''; in ManiphestEditEngine with a string and going to any other task not closed as a duplicate.

aklapper requested review of this revision.Mon, Apr 8, 11:01
aklapper marked an inline comment as done.

Ouch I see that receiving the engine was very complicated.

I wonder how this was used. I mean. If we have something like this:

(new PhabricatorApplicationTransactionCommentView())
  ->render();

Maybe we can add our dependency:

(new PhabricatorApplicationTransactionCommentView())
  ->setEngine($engine)
  ->render();

But this is just a stupid idea - and I'm sorry that this is becoming so time expensive

I guess another question is whether to define an abstract public function getCommentFieldPlaceholderText() in parent PhabricatorEditEngine and then add to all and every child EditEngine a default public function getCommentFieldPlaceholderText($object_phid) { return '' };. Feels cleaner to me.

and I'm sorry that this is becoming so time expensive

Nah, I see some potential in this, so I wanted to have the code properly split between general functionality implementation and per-app conditions and behavior. :)

Maybe we can add our dependency:

(new PhabricatorApplicationTransactionCommentView())
  ->setEngine($engine)
  ->render();

ManiphestEditEngine does not instantiate a PhabricatorApplicationTransactionCommentView directly, it goes via the parent class PhabricatorEditEngine...