gr-related-changes: Don't show "Same topic" for only one change

When there is only one change in the topic, it doesn't add any value
to show the "Same topic" section because it will always only include
the currently viewed change.

Change the query used to get the changes to exclude the current change.

This introduces a slight change in behavior: the "Same topic" section
now only shows other changes on the same topic as the current change,
but never includes the current change.

Bug: Issue 10317
Change-Id: I4840acabe3374bc818cbe21392e7d598f4b1fd42
This commit is contained in:
Paladox none
2019-01-17 02:21:09 +00:00
committed by David Pursehouse
parent 5a6a91c4bb
commit b6c1330426
2 changed files with 9 additions and 3 deletions

View File

@@ -160,7 +160,8 @@
},
_getChangesWithSameTopic() {
return this.$.restAPI.getChangesWithSameTopic(this.change.topic);
return this.$.restAPI.getChangesWithSameTopic(this.change.topic,
this.change._number);
},
/**

View File

@@ -1215,16 +1215,21 @@
return this.fetchJSON('/changes/', null, null, params);
},
getChangesWithSameTopic(topic) {
getChangesWithSameTopic(topic, changeNum) {
const options = this.listChangesOptionsToHex(
this.ListChangesOption.LABELS,
this.ListChangesOption.CURRENT_REVISION,
this.ListChangesOption.CURRENT_COMMIT,
this.ListChangesOption.DETAILED_LABELS
);
const query = [
'status:open',
'-change:' + changeNum,
'topic:' + topic,
].join(' ');
const params = {
O: options,
q: 'status:open topic:' + topic,
q: query,
};
return this.fetchJSON('/changes/', null, null, params);
},