1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +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');
$viewer = $this->getViewer();
$pref = $viewer->loadPreferences()->getPreference(
PhabricatorUserPreferences::PREFERENCE_DIFF_GHOSTS);
if ($pref == 'disabled') {
return $inlines;
}
$all = array_merge($old, $new);
$changeset_ids = mpull($inlines, 'getChangesetID');

View file

@ -20,6 +20,7 @@ final class PhabricatorDiffPreferencesSettingsPanel
$preferences = $user->loadPreferences();
$pref_unified = PhabricatorUserPreferences::PREFERENCE_DIFF_UNIFIED;
$pref_ghosts = PhabricatorUserPreferences::PREFERENCE_DIFF_GHOSTS;
$pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE;
if ($request->isFormPost()) {
@ -36,6 +37,9 @@ final class PhabricatorDiffPreferencesSettingsPanel
$unified = $request->getStr($pref_unified);
$preferences->setPreference($pref_unified, $unified);
$ghosts = $request->getStr($pref_ghosts);
$preferences->setPreference($pref_ghosts, $ghosts);
$preferences->save();
return id(new AphrontRedirectResponse())
->setURI($this->getPanelURI('?saved=true'));
@ -60,6 +64,16 @@ final class PhabricatorDiffPreferencesSettingsPanel
'default' => pht('On Small Screens'),
'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(
id(new AphrontFormSelectControl())
->setLabel(pht('Show Filetree'))

View file

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