mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 15:56:10 +08:00
fix(labels): Do not re-use mail labels if they're removable
This commit is contained in:
parent
d28c79fc75
commit
7c2fd2a91b
|
@ -227,7 +227,7 @@ class MessageList extends React.Component
|
|||
<MailImportantIcon thread={@state.currentThread}/>
|
||||
<div style={flex: 1}>
|
||||
<span className="message-subject">{subject}</span>
|
||||
<MailLabelSet thread={@state.currentThread} includeCurrentCategories={true} />
|
||||
<MailLabelSet removable={true} thread={@state.currentThread} includeCurrentCategories={true} />
|
||||
</div>
|
||||
{@_renderIcons()}
|
||||
</div>
|
||||
|
|
|
@ -48,17 +48,6 @@
|
|||
-webkit-font-smoothing: subpixel-antialiased;
|
||||
}
|
||||
|
||||
// Do not show the "removable" X on mail labels within the thread list.
|
||||
.mail-label {
|
||||
padding: 1px 8px;
|
||||
.inner {
|
||||
position: inherit;
|
||||
}
|
||||
.x {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.swipe-backing {
|
||||
background-color: darken(@background-primary, 10%);
|
||||
&::after {
|
||||
|
|
|
@ -16,6 +16,7 @@ export default class MailLabelSet extends React.Component {
|
|||
static propTypes = {
|
||||
thread: React.PropTypes.object.isRequired,
|
||||
includeCurrentCategories: React.PropTypes.bool,
|
||||
removable: React.PropTypes.bool,
|
||||
};
|
||||
|
||||
_onRemoveLabel(label) {
|
||||
|
@ -45,15 +46,22 @@ export default class MailLabelSet extends React.Component {
|
|||
if (ignoredNames.includes(label.name) || ignoredIds.includes(label.id)) {
|
||||
continue;
|
||||
}
|
||||
if (LabelComponentCache[label.id] === undefined) {
|
||||
LabelComponentCache[label.id] = (
|
||||
|
||||
if (this.props.removable) {
|
||||
labels.push (
|
||||
<MailLabel
|
||||
label={label}
|
||||
key={label.id}
|
||||
onRemove={()=> this._onRemoveLabel(label)}/>
|
||||
);
|
||||
onRemove={()=> this._onRemoveLabel(label)} />
|
||||
)
|
||||
} else {
|
||||
if (LabelComponentCache[label.id] === undefined) {
|
||||
LabelComponentCache[label.id] = (
|
||||
<MailLabel label={label} key={label.id} />
|
||||
);
|
||||
}
|
||||
labels.push(LabelComponentCache[label.id]);
|
||||
}
|
||||
labels.push(LabelComponentCache[label.id]);
|
||||
}
|
||||
}
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue