From d63e530608e9cd8a258308bd192a13a3e32a3524 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 6 Jan 2014 11:19:02 -0800 Subject: [PATCH] Phriction - fix a corner case on renaming a project Summary: if you rename a project in such a way that the old slug and the new slug are the same, there are errors when the phriction document is updated. detect this case and don't bother updating the document since there is no change. Fixes Github issue 474. Test Plan: made a project "testTest". Viewed the wiki page. Created the wiki page. Renamed the project "TestTest". Before patch, this error'd, post patch it works! Reviewers: epriestley Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7888 --- src/applications/project/editor/PhabricatorProjectEditor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/applications/project/editor/PhabricatorProjectEditor.php b/src/applications/project/editor/PhabricatorProjectEditor.php index f8367e80f0..192846ec69 100644 --- a/src/applications/project/editor/PhabricatorProjectEditor.php +++ b/src/applications/project/editor/PhabricatorProjectEditor.php @@ -250,8 +250,8 @@ final class PhabricatorProjectEditor extends PhabricatorEditor { $old_slug = $project->getFullPhrictionSlug(); $project->setName($xaction->getNewValue()); $project->setPhrictionSlug($xaction->getNewValue()); - - if ($xaction->getOldValue()) { + $changed_slug = $old_slug != $project->getFullPhrictionSlug(); + if ($xaction->getOldValue() && $changed_slug) { $old_document = id(new PhrictionDocument()) ->loadOneWhere( 'slug = %s', -- 2.51.2