From cadd3f1056205bd357a9e5d4e7e47aeb1111d5c6 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 18 Jan 2016 09:09:02 -0800 Subject: [PATCH] When removing project slugs, try to remove raw slugs too so we can remove old/invalid slugs Summary: Ref T10168. When we try to remove an additional hashtag, we remove the normalized version. Instead, remove both the literal and normalized versions. This allows us to remove old/invalid slugs. Test Plan: Removed garbage slugs like `[,*,]`. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10168 Differential Revision: https://secure.phabricator.com/D15048 --- .../editor/PhabricatorProjectTransactionEditor.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index 54440a6ee9..c8175e6cd7 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -756,12 +756,17 @@ final class PhabricatorProjectTransactionEditor } private function removeSlugs(PhabricatorProject $project, array $slugs) { - $slugs = $this->normalizeSlugs($slugs); - if (!$slugs) { return; } + // We're going to try to delete both the literal and normalized versions + // of all slugs. This allows us to destroy old slugs that are no longer + // valid. + foreach ($this->normalizeSlugs($slugs) as $slug) { + $slugs[] = $slug; + } + $objects = id(new PhabricatorProjectSlug())->loadAllWhere( 'projectPHID = %s AND slug IN (%Ls)', $project->getPHID(),