Lower threshold for switching to unified diff

We show diffs as unified, if the window width is smaller than a certain
threshold. This is problematic, because the diff stays unified even
after the user increases the window width.

Having heard a complaint from a user and having verified that they
would be happy with a threshold of 850, we are lowering the threshold
from 900 to 850.

Change-Id: I543ee0faccb6a5d9804ca0d5787d5c24e8358a9d
This commit is contained in:
Ben Rohlfs
2019-10-01 08:28:51 +02:00
parent 193b7cac16
commit e32aaff134

View File

@@ -91,7 +91,8 @@
};
const JSON_PREFIX = ')]}\'';
const MAX_PROJECT_RESULTS = 25;
const MAX_UNIFIED_DEFAULT_WINDOW_WIDTH_PX = 900;
// This value is somewhat arbitrary and not based on research or calculations.
const MAX_UNIFIED_DEFAULT_WINDOW_WIDTH_PX = 850;
const PARENT_PATCH_NUM = 'PARENT';
const Requests = {
@@ -942,6 +943,8 @@
const req = {url: '/accounts/self/preferences', reportUrlAsIs: true};
return this._fetchSharedCacheURL(req).then(res => {
if (this._isNarrowScreen()) {
// Note that this can be problematic, because the diff will stay
// unified even after increasing the window width.
res.default_diff_view = DiffViewMode.UNIFIED;
} else {
res.default_diff_view = res.diff_view;