Merge branch 'stable-3.0' into stable-3.1

* stable-3.0:
  Collapse all change messages by default

Change-Id: I6fbd89d98ed692532db346b7f591b494b6765845
This commit is contained in:
Luca Milanesio
2020-06-10 12:50:40 +01:00
3 changed files with 13 additions and 12 deletions

View File

@@ -49,7 +49,6 @@
}, },
comments: { comments: {
type: Object, type: Object,
observer: '_commentsChanged',
}, },
config: Object, config: Object,
hideAutomated: { hideAutomated: {
@@ -151,17 +150,6 @@
return expanded; return expanded;
}, },
/**
* If there is no value set on the message object as to whether _expanded
* should be true or not, then _expanded is set to true if there are
* inline comments (otherwise false).
*/
_commentsChanged(value) {
if (this.message && this.message.expanded === undefined) {
this.set('message.expanded', Object.keys(value || {}).length > 0);
}
},
_handleClick(e) { _handleClick(e) {
if (this.message.expanded) { return; } if (this.message.expanded) { return; }
e.stopPropagation(); e.stopPropagation();

View File

@@ -58,6 +58,7 @@ limitations under the License.
date: '2016-01-12 20:24:49.448000000', date: '2016-01-12 20:24:49.448000000',
message: 'Uploaded patch set 1.', message: 'Uploaded patch set 1.',
_revision_number: 1, _revision_number: 1,
expanded: false,
}; };
element.addEventListener('reply', e => { element.addEventListener('reply', e => {
@@ -72,6 +73,7 @@ limitations under the License.
element.message = { element.message = {
tag: 'autogenerated:gerrit:test', tag: 'autogenerated:gerrit:test',
updated: '2016-01-12 20:24:49.448000000', updated: '2016-01-12 20:24:49.448000000',
expanded: false,
}; };
assert.isTrue(element.isAutomated); assert.isTrue(element.isAutomated);
@@ -87,6 +89,7 @@ limitations under the License.
tag: 'autogenerated:gerrit:test', tag: 'autogenerated:gerrit:test',
updated: '2016-01-12 20:24:49.448000000', updated: '2016-01-12 20:24:49.448000000',
reviewer: {}, reviewer: {},
expanded: false,
}; };
assert.isTrue(element.isAutomated); assert.isTrue(element.isAutomated);
@@ -102,6 +105,7 @@ limitations under the License.
type: 'REVIEWER_UPDATE', type: 'REVIEWER_UPDATE',
updated: '2016-01-12 20:24:49.448000000', updated: '2016-01-12 20:24:49.448000000',
reviewer: {}, reviewer: {},
expanded: false,
}; };
assert.isTrue(element.isAutomated); assert.isTrue(element.isAutomated);
@@ -116,6 +120,7 @@ limitations under the License.
element.message = { element.message = {
tag: 'something', tag: 'something',
updated: '2016-01-12 20:24:49.448000000', updated: '2016-01-12 20:24:49.448000000',
expanded: false,
}; };
assert.isFalse(element.isAutomated); assert.isFalse(element.isAutomated);
@@ -129,6 +134,7 @@ limitations under the License.
test('reply button hidden unless logged in', () => { test('reply button hidden unless logged in', () => {
const message = { const message = {
message: 'Uploaded patch set 1.', message: 'Uploaded patch set 1.',
expanded: false,
}; };
assert.isFalse(element._computeShowReplyButton(message, false)); assert.isFalse(element._computeShowReplyButton(message, false));
assert.isTrue(element._computeShowReplyButton(message, true)); assert.isTrue(element._computeShowReplyButton(message, true));
@@ -137,6 +143,7 @@ limitations under the License.
test('_computeShowOnBehalfOf', () => { test('_computeShowOnBehalfOf', () => {
const message = { const message = {
message: '...', message: '...',
expanded: false,
}; };
assert.isNotOk(element._computeShowOnBehalfOf(message)); assert.isNotOk(element._computeShowOnBehalfOf(message));
message.author = {_account_id: 1115495}; message.author = {_account_id: 1115495};
@@ -172,6 +179,7 @@ limitations under the License.
updated: '2016-01-12 20:24:49.448000000', updated: '2016-01-12 20:24:49.448000000',
reviewer: {}, reviewer: {},
id: '47c43261_55aa2c41', id: '47c43261_55aa2c41',
expanded: false,
}; };
flushAsynchronousOperations(); flushAsynchronousOperations();
const stub = sinon.stub(); const stub = sinon.stub();

View File

@@ -151,6 +151,11 @@
mDate = null; mDate = null;
} }
} }
result.forEach(m => {
if (m.expanded === undefined) {
m.expanded = false;
}
});
return result; return result;
}, },