1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Fix project page 404 after rename and removing new name from alias slugs

Summary:
When renaming a project to a slug already listed under Additional hashtags and explicitly also removing that to-become slug, accessing the project via the URL `/tag/projectname/` returned a 404 until someone added the current project name explicitly under "Additional hashtags" again.

In that case, do not remove the alternative hashtag to avoid the 404.

Closes T15636

Test Plan: See steps in https://we.phorge.it/T15636

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15636

Differential Revision: https://we.phorge.it/D25453
This commit is contained in:
Andre Klapper 2023-10-28 20:23:42 +02:00
parent 222a6fea0a
commit 887e344c19

View file

@ -295,6 +295,12 @@ final class PhabricatorProjectTransactionEditor
} }
public function removeSlugs(PhabricatorProject $project, array $slugs) { public function removeSlugs(PhabricatorProject $project, array $slugs) {
// Do not allow removing the project's primary slug which the edit form
// may allow through a series of renames/moves. See T15636
if (($key = array_search($project->getPrimarySlug(), $slugs)) !== false) {
unset($slugs[$key]);
}
if (!$slugs) { if (!$slugs) {
return; return;
} }