Merge "Add the attention icon to the modify section in the reply dialog"

This commit is contained in:
Ben Rohlfs
2020-07-22 09:06:17 +00:00
committed by Gerrit Code Review
3 changed files with 23 additions and 16 deletions

View File

@@ -321,13 +321,13 @@ export const htmlTemplate = html`
<div class="attentionDetailsTitle"> <div class="attentionDetailsTitle">
<iron-icon class="attention-icon" icon="gr-icons:attention"></iron-icon> <iron-icon class="attention-icon" icon="gr-icons:attention"></iron-icon>
<span>Bring to attention of ...</span> <span>Bring to attention of ...</span>
<span class="selectUsers">(select users)</span> <span class="selectUsers">(click chips to select users)</span>
</div> </div>
<div class="peopleList"> <div class="peopleList">
<div class="peopleListLabel">Owner</div> <div class="peopleListLabel">Owner</div>
<gr-account-label <gr-account-label
account="[[_owner]]" account="[[_owner]]"
show-attention="[[_computeHasNewAttention(_owner, _newAttentionSet)]]" force-attention="[[_computeHasNewAttention(_owner, _newAttentionSet)]]"
blurred="[[!_computeHasNewAttention(_owner, _newAttentionSet)]]" blurred="[[!_computeHasNewAttention(_owner, _newAttentionSet)]]"
hide-hovercard="" hide-hovercard=""
on-click="_handleAttentionClick" on-click="_handleAttentionClick"
@@ -339,7 +339,7 @@ export const htmlTemplate = html`
<template is="dom-repeat" items="[[_reviewers]]" as="account"> <template is="dom-repeat" items="[[_reviewers]]" as="account">
<gr-account-label <gr-account-label
account="[[account]]" account="[[account]]"
show-attention="[[_computeHasNewAttention(account, _newAttentionSet)]]" force-attention="[[_computeHasNewAttention(account, _newAttentionSet)]]"
blurred="[[!_computeHasNewAttention(account, _newAttentionSet)]]" blurred="[[!_computeHasNewAttention(account, _newAttentionSet)]]"
hide-hovercard="" hide-hovercard=""
on-click="_handleAttentionClick" on-click="_handleAttentionClick"
@@ -352,7 +352,7 @@ export const htmlTemplate = html`
<template is="dom-repeat" items="[[_ccs]]" as="account"> <template is="dom-repeat" items="[[_ccs]]" as="account">
<gr-account-label <gr-account-label
account="[[account]]" account="[[account]]"
show-attention="[[_computeHasNewAttention(account, _newAttentionSet)]]" force-attention="[[_computeHasNewAttention(account, _newAttentionSet)]]"
blurred="[[!_computeHasNewAttention(account, _newAttentionSet)]]" blurred="[[!_computeHasNewAttention(account, _newAttentionSet)]]"
hide-hovercard="" hide-hovercard=""
on-click="_handleAttentionClick" on-click="_handleAttentionClick"

View File

@@ -48,6 +48,15 @@ class GrAccountLabel extends GestureEventListeners(
*/ */
change: Object, change: Object,
voteableText: String, voteableText: String,
/**
* Should this user be considered to be in the attention set, regardless
* of the current state of the change object? This can be used in a widget
* that allows the user to make adjustments to the attention set.
*/
forceAttention: {
type: Boolean,
value: false,
},
/** /**
* Should attention set related features be shown in the component? Note * Should attention set related features be shown in the component? Note
* that the information whether the user is in the attention set or not is * that the information whether the user is in the attention set or not is
@@ -90,19 +99,17 @@ class GrAccountLabel extends GestureEventListeners(
this.$.restAPI.getConfig().then(config => { this._config = config; }); this.$.restAPI.getConfig().then(config => { this._config = config; });
} }
get isAttentionSetEnabled() { _isAttentionSetEnabled(config, highlight, account, change) {
return !!this._config && !!this._config.change return !!config && !!config.change
&& !!this._config.change.enable_attention_set && !!config.change.enable_attention_set
&& !!this.highlightAttention && !!this.change && !!this.account; && !!highlight && !!change && !!account;
} }
get hasAttention() { _hasAttention(config, highlight, account, change, force) {
if (!this.isAttentionSetEnabled || !this.change.attention_set) return false; if (force) return true;
return this.change.attention_set.hasOwnProperty(this.account._account_id); return this._isAttentionSetEnabled(config, highlight, account, change)
} && change.attention_set
&& change.attention_set.hasOwnProperty(account._account_id);
_computeShowAttentionIcon(config, highlightAttention, account, change) {
return this.isAttentionSetEnabled && this.hasAttention;
} }
_computeName(account, config) { _computeName(account, config) {

View File

@@ -78,7 +78,7 @@ export const htmlTemplate = html`
</template> </template>
<template <template
is="dom-if" is="dom-if"
if="[[_computeShowAttentionIcon(_config, highlightAttention, account, change)]]" if="[[_hasAttention(_config, highlightAttention, account, change, forceAttention)]]"
> >
<iron-icon class="attention" icon="gr-icons:attention"></iron-icon> <iron-icon class="attention" icon="gr-icons:attention"></iron-icon>
</template> </template>