1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Feed Differential retitled: do not repeat the title twice

Summary:
This is a cosmetic modification for a specific Feed.

https://we.phorge.it/T15183

If you retitle a Diff (and you do nothing else), its Feed
is somehow too much verbose:

    ... retitled NEW_TITLE from OLD_TITLE to NEW_TITLE

In this specific case, the Feed now becomes shorter so that
the NEW_TITLE is not repeated twice:

    ... retitled NEW_TITLE from OLD_TITLE

Note that, if the title changes again, the Feed naturally comes
back as before so to mention the change and obviously without
any repetition. Example:

    ... retitled CURRENT_TITLE from OLD_TITLE to NEW_TITLE

Closes T15183

Test Plan:
- take a Diff named "OLD_TITLE" and retitle to "NEW_TITLE"
- visit the homepage and see "retitled NEW_TITLE from OLD_TITLE"
  (this means the new behavior works)
- retitle the Diff from "NEW_TITLE" to "CURRENT_TITLE"
- visit the homepage again and see "retitled CURRENT_TITLE from OLD_TITLE to NEW_TITLE"
  (this means the old behavior still works)

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15183

Differential Revision: https://we.phorge.it/D25094
This commit is contained in:
Valerio Bozzolan 2023-03-25 14:20:53 +01:00
parent 9bc3c16b6e
commit 42a8b73adb

View file

@ -23,6 +23,17 @@ final class DifferentialRevisionTitleTransaction
}
public function getTitleForFeed() {
$obj = $this->getObject();
// To avoid verbose messages we mention the current title just once
if ($obj && $obj->getTitle() === $this->getNewValue()) {
return pht(
'%s retitled %s from %s',
$this->renderAuthor(),
$this->renderObject(),
$this->renderOldValue());
}
return pht(
'%s retitled %s from %s to %s.',
$this->renderAuthor(),