1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Add a preference to disable ghost comments

Summary: Ref T7447. At least some users dislike this feature so strongly that they'd prefer not to have it at all.

Test Plan: Viewed ghosts; toggled preference, no more ghosts.

Reviewers: chad

Reviewed By: chad

Subscribers: yelirekim, epriestley

Maniphest Tasks: T7447

Differential Revision: https://secure.phabricator.com/D12704
This commit is contained in:
epriestley 2015-05-04 12:02:42 -07:00
parent 861155ea73
commit 29feca3c1e
3 changed files with 22 additions and 0 deletions

View file

@ -148,6 +148,13 @@ final class DifferentialInlineCommentQuery
assert_instances_of($new, 'DifferentialChangeset'); assert_instances_of($new, 'DifferentialChangeset');
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$pref = $viewer->loadPreferences()->getPreference(
PhabricatorUserPreferences::PREFERENCE_DIFF_GHOSTS);
if ($pref == 'disabled') {
return $inlines;
}
$all = array_merge($old, $new); $all = array_merge($old, $new);
$changeset_ids = mpull($inlines, 'getChangesetID'); $changeset_ids = mpull($inlines, 'getChangesetID');

View file

@ -20,6 +20,7 @@ final class PhabricatorDiffPreferencesSettingsPanel
$preferences = $user->loadPreferences(); $preferences = $user->loadPreferences();
$pref_unified = PhabricatorUserPreferences::PREFERENCE_DIFF_UNIFIED; $pref_unified = PhabricatorUserPreferences::PREFERENCE_DIFF_UNIFIED;
$pref_ghosts = PhabricatorUserPreferences::PREFERENCE_DIFF_GHOSTS;
$pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE; $pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE;
if ($request->isFormPost()) { if ($request->isFormPost()) {
@ -36,6 +37,9 @@ final class PhabricatorDiffPreferencesSettingsPanel
$unified = $request->getStr($pref_unified); $unified = $request->getStr($pref_unified);
$preferences->setPreference($pref_unified, $unified); $preferences->setPreference($pref_unified, $unified);
$ghosts = $request->getStr($pref_ghosts);
$preferences->setPreference($pref_ghosts, $ghosts);
$preferences->save(); $preferences->save();
return id(new AphrontRedirectResponse()) return id(new AphrontRedirectResponse())
->setURI($this->getPanelURI('?saved=true')); ->setURI($this->getPanelURI('?saved=true'));
@ -60,6 +64,16 @@ final class PhabricatorDiffPreferencesSettingsPanel
'default' => pht('On Small Screens'), 'default' => pht('On Small Screens'),
'unified' => pht('Always'), 'unified' => pht('Always'),
))) )))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Show Older Inlines'))
->setName($pref_ghosts)
->setValue($preferences->getPreference($pref_ghosts))
->setOptions(
array(
'default' => pht('Enabled'),
'disabled' => pht('Disabled'),
)))
->appendChild( ->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormSelectControl())
->setLabel(pht('Show Filetree')) ->setLabel(pht('Show Filetree'))

View file

@ -31,6 +31,7 @@ final class PhabricatorUserPreferences extends PhabricatorUserDAO {
const PREFERENCE_DIFF_UNIFIED = 'diff-unified'; const PREFERENCE_DIFF_UNIFIED = 'diff-unified';
const PREFERENCE_DIFF_FILETREE = 'diff-filetree'; const PREFERENCE_DIFF_FILETREE = 'diff-filetree';
const PREFERENCE_DIFF_GHOSTS = 'diff-ghosts';
const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications'; const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications';
const PREFERENCE_CONPHERENCE_COLUMN = 'conpherence-column'; const PREFERENCE_CONPHERENCE_COLUMN = 'conpherence-column';