Merge "Fix more to support undefined behaviour"

This commit is contained in:
Paladox none
2020-01-13 14:56:17 +00:00
committed by Gerrit Code Review
3 changed files with 12 additions and 3 deletions

View File

@@ -55,6 +55,9 @@ limitations under the License.
* @return {boolean}
*/
isColumnHidden(columnToCheck, columnsToDisplay) {
if ([columnsToDisplay, columnToCheck].some(arg => arg === undefined)) {
return false;
}
return !columnsToDisplay.includes(columnToCheck);
},

View File

@@ -187,8 +187,13 @@
if (account) {
this.showNumber = !!(preferences &&
preferences.legacycid_in_change_table);
this.visibleChangeTableColumns = preferences.change_table.length > 0 ?
this.getVisibleColumns(preferences.change_table) : this.columnNames;
if (preferences.change_table &&
preferences.change_table.length > 0) {
this.visibleChangeTableColumns =
this.getVisibleColumns(preferences.change_table);
} else {
this.visibleChangeTableColumns = this.columnNames;
}
} else {
// Not logged in.
this.showNumber = false;

View File

@@ -305,7 +305,8 @@
if (!account) { return; }
this.$.restAPI.getPreferences().then(prefs => {
this._userLinks = prefs.my.map(this._fixCustomMenuItem);
this._userLinks = prefs && prefs.my ?
prefs.my.map(this._fixCustomMenuItem) : [];
});
}