From 4dae3e7e1fbf462a8b77f654b8e990dfd9fa7942 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 1 Apr 2022 12:47:19 -0700 Subject: [PATCH] Improve some UI/language for Phame posts when viewer doesn't have CAN_INTERACT Summary: Ref T13661. Fix up some UI and language so it's more clear that this is about disabling blog comments. Test Plan: Viewed UIs, saw some more usable strings. Maniphest Tasks: T13661 Differential Revision: https://secure.phabricator.com/D21755 --- src/__phutil_library_map__.php | 3 ++ .../phame/editor/PhamePostEditEngineLock.php | 29 +++++++++++++++++++ src/applications/phame/storage/PhamePost.php | 8 +++++ 3 files changed, 40 insertions(+) create mode 100644 src/applications/phame/editor/PhamePostEditEngineLock.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 241bd7f87e..2b6f135645 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -5288,6 +5288,7 @@ phutil_register_library_map(array( 'PhamePostEditConduitAPIMethod' => 'applications/phame/conduit/PhamePostEditConduitAPIMethod.php', 'PhamePostEditController' => 'applications/phame/controller/post/PhamePostEditController.php', 'PhamePostEditEngine' => 'applications/phame/editor/PhamePostEditEngine.php', + 'PhamePostEditEngineLock' => 'applications/phame/editor/PhamePostEditEngineLock.php', 'PhamePostEditor' => 'applications/phame/editor/PhamePostEditor.php', 'PhamePostFerretEngine' => 'applications/phame/search/PhamePostFerretEngine.php', 'PhamePostFulltextEngine' => 'applications/phame/search/PhamePostFulltextEngine.php', @@ -12182,6 +12183,7 @@ phutil_register_library_map(array( 'PhabricatorDestructibleInterface', 'PhabricatorTokenReceiverInterface', 'PhabricatorConduitResultInterface', + 'PhabricatorEditEngineLockableInterface', 'PhabricatorFulltextInterface', 'PhabricatorFerretInterface', ), @@ -12192,6 +12194,7 @@ phutil_register_library_map(array( 'PhamePostEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'PhamePostEditController' => 'PhamePostController', 'PhamePostEditEngine' => 'PhabricatorEditEngine', + 'PhamePostEditEngineLock' => 'PhabricatorEditEngineLock', 'PhamePostEditor' => 'PhabricatorApplicationTransactionEditor', 'PhamePostFerretEngine' => 'PhabricatorFerretEngine', 'PhamePostFulltextEngine' => 'PhabricatorFulltextEngine', diff --git a/src/applications/phame/editor/PhamePostEditEngineLock.php b/src/applications/phame/editor/PhamePostEditEngineLock.php new file mode 100644 index 0000000000..2c3ff01f20 --- /dev/null +++ b/src/applications/phame/editor/PhamePostEditEngineLock.php @@ -0,0 +1,29 @@ +setTitle(pht('Edit Locked Post')) + ->appendParagraph( + pht('Comments are disabled for this post. Edit it anyway?')) + ->addSubmitButton(pht('Edit Post')); + } + + public function willBlockUserInteractionWithDialog( + AphrontDialogView $dialog) { + + return $dialog + ->setTitle(pht('Post Locked')) + ->appendParagraph( + pht('You can not interact with this post because it is locked.')); + } + + public function getLockedObjectDisplayText() { + return pht('Comments have been disabled for this post.'); + } + +} diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php index ff8974e1d6..21149f07c2 100644 --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -11,6 +11,7 @@ final class PhamePost extends PhameDAO PhabricatorDestructibleInterface, PhabricatorTokenReceiverInterface, PhabricatorConduitResultInterface, + PhabricatorEditEngineLockableInterface, PhabricatorFulltextInterface, PhabricatorFerretInterface { @@ -393,4 +394,11 @@ final class PhamePost extends PhameDAO return new PhamePostFerretEngine(); } + +/* -( PhabricatorEditEngineLockableInterface )----------------------------- */ + + public function newEditEngineLock() { + return new PhamePostEditEngineLock(); + } + } -- 2.51.2