Merge "Add the attention icon to the modify section in the reply dialog"
This commit is contained in:
@@ -321,13 +321,13 @@ export const htmlTemplate = html`
|
||||
<div class="attentionDetailsTitle">
|
||||
<iron-icon class="attention-icon" icon="gr-icons:attention"></iron-icon>
|
||||
<span>Bring to attention of ...</span>
|
||||
<span class="selectUsers">(select users)</span>
|
||||
<span class="selectUsers">(click chips to select users)</span>
|
||||
</div>
|
||||
<div class="peopleList">
|
||||
<div class="peopleListLabel">Owner</div>
|
||||
<gr-account-label
|
||||
account="[[_owner]]"
|
||||
show-attention="[[_computeHasNewAttention(_owner, _newAttentionSet)]]"
|
||||
force-attention="[[_computeHasNewAttention(_owner, _newAttentionSet)]]"
|
||||
blurred="[[!_computeHasNewAttention(_owner, _newAttentionSet)]]"
|
||||
hide-hovercard=""
|
||||
on-click="_handleAttentionClick"
|
||||
@@ -339,7 +339,7 @@ export const htmlTemplate = html`
|
||||
<template is="dom-repeat" items="[[_reviewers]]" as="account">
|
||||
<gr-account-label
|
||||
account="[[account]]"
|
||||
show-attention="[[_computeHasNewAttention(account, _newAttentionSet)]]"
|
||||
force-attention="[[_computeHasNewAttention(account, _newAttentionSet)]]"
|
||||
blurred="[[!_computeHasNewAttention(account, _newAttentionSet)]]"
|
||||
hide-hovercard=""
|
||||
on-click="_handleAttentionClick"
|
||||
@@ -352,7 +352,7 @@ export const htmlTemplate = html`
|
||||
<template is="dom-repeat" items="[[_ccs]]" as="account">
|
||||
<gr-account-label
|
||||
account="[[account]]"
|
||||
show-attention="[[_computeHasNewAttention(account, _newAttentionSet)]]"
|
||||
force-attention="[[_computeHasNewAttention(account, _newAttentionSet)]]"
|
||||
blurred="[[!_computeHasNewAttention(account, _newAttentionSet)]]"
|
||||
hide-hovercard=""
|
||||
on-click="_handleAttentionClick"
|
||||
|
||||
@@ -48,6 +48,15 @@ class GrAccountLabel extends GestureEventListeners(
|
||||
*/
|
||||
change: Object,
|
||||
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
|
||||
* 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; });
|
||||
}
|
||||
|
||||
get isAttentionSetEnabled() {
|
||||
return !!this._config && !!this._config.change
|
||||
&& !!this._config.change.enable_attention_set
|
||||
&& !!this.highlightAttention && !!this.change && !!this.account;
|
||||
_isAttentionSetEnabled(config, highlight, account, change) {
|
||||
return !!config && !!config.change
|
||||
&& !!config.change.enable_attention_set
|
||||
&& !!highlight && !!change && !!account;
|
||||
}
|
||||
|
||||
get hasAttention() {
|
||||
if (!this.isAttentionSetEnabled || !this.change.attention_set) return false;
|
||||
return this.change.attention_set.hasOwnProperty(this.account._account_id);
|
||||
}
|
||||
|
||||
_computeShowAttentionIcon(config, highlightAttention, account, change) {
|
||||
return this.isAttentionSetEnabled && this.hasAttention;
|
||||
_hasAttention(config, highlight, account, change, force) {
|
||||
if (force) return true;
|
||||
return this._isAttentionSetEnabled(config, highlight, account, change)
|
||||
&& change.attention_set
|
||||
&& change.attention_set.hasOwnProperty(account._account_id);
|
||||
}
|
||||
|
||||
_computeName(account, config) {
|
||||
|
||||
@@ -78,7 +78,7 @@ export const htmlTemplate = html`
|
||||
</template>
|
||||
<template
|
||||
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>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user