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: {
type: Object,
observer: '_commentsChanged',
},
config: Object,
hideAutomated: {
@@ -151,17 +150,6 @@
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) {
if (this.message.expanded) { return; }
e.stopPropagation();

View File

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

View File

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