mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 08:04:11 +08:00
Add mark as spam / not spam to the thread list context menu #1011
This commit is contained in:
parent
33cf7b5b67
commit
cfe39d3bab
1 changed files with 26 additions and 1 deletions
|
@ -31,6 +31,7 @@ export default class ThreadListContextMenu {
|
|||
this.archiveItem(),
|
||||
this.trashItem(),
|
||||
this.markAsReadItem(),
|
||||
this.markAsSpamItem(),
|
||||
this.starItem(),
|
||||
]);
|
||||
})
|
||||
|
@ -48,7 +49,9 @@ export default class ThreadListContextMenu {
|
|||
if (this.threadIds.length !== 1) {
|
||||
return null;
|
||||
}
|
||||
const from = this.threads[0].participants.find(p => !p.isMe());
|
||||
const first = this.threads[0];
|
||||
const from = first.participants.find(p => !p.isMe()) || first.participants[0];
|
||||
|
||||
return {
|
||||
label: `Search for ${from.email}`,
|
||||
click: () => {
|
||||
|
@ -179,6 +182,28 @@ export default class ThreadListContextMenu {
|
|||
};
|
||||
}
|
||||
|
||||
markAsSpamItem() {
|
||||
const allInSpam = this.threads.every(item => item.folders.find(c => c.role === 'spam'));
|
||||
const dir = allInSpam ? 'Not Spam' : 'Spam';
|
||||
|
||||
return {
|
||||
label: `Mark as ${dir}`,
|
||||
click: () => {
|
||||
Actions.queueTasks(
|
||||
allInSpam
|
||||
? TaskFactory.tasksForMarkingNotSpam({
|
||||
source: 'Context Menu: Thread List',
|
||||
threads: this.threads,
|
||||
})
|
||||
: TaskFactory.tasksForMarkingAsSpam({
|
||||
source: 'Context Menu: Thread List',
|
||||
threads: this.threads,
|
||||
})
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
starItem() {
|
||||
const starred = this.threads.every(t => t.starred === false);
|
||||
|
||||
|
|
Loading…
Reference in a new issue