mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-06 19:26:55 +08:00
fix(sent): Do not allow sent or drafts to be modified
- Specifically, when dragging from the sent perspective, we should not allow the sent label to be removed. - If moved to trash or spam, `all mail` will be correctly removed from the thread, but it will keep sent label - Show sent MailLabel on the threads
This commit is contained in:
parent
b9810d5983
commit
23c68df4c0
4 changed files with 9 additions and 6 deletions
|
@ -58,5 +58,5 @@ describe 'Category', ->
|
||||||
cat.name = 'sent'
|
cat.name = 'sent'
|
||||||
expect(cat.isUserCategory()).toBe false
|
expect(cat.isUserCategory()).toBe false
|
||||||
expect(cat.isStandardCategory()).toBe true
|
expect(cat.isStandardCategory()).toBe true
|
||||||
expect(cat.isHiddenCategory()).toBe true
|
expect(cat.isHiddenCategory()).toBe false
|
||||||
expect(cat.isLockedCategory()).toBe true
|
expect(cat.isLockedCategory()).toBe true
|
||||||
|
|
|
@ -70,8 +70,8 @@ describe 'Thread', ->
|
||||||
expect(actualOut.length).toBe 1
|
expect(actualOut.length).toBe 1
|
||||||
expect(actualOut[0].displayName).toBe 'not important'
|
expect(actualOut[0].displayName).toBe 'not important'
|
||||||
|
|
||||||
it "doesn't display 'sent', 'all', 'archive', or 'drafts'", ->
|
it "doesn't display 'all', 'archive', or 'drafts'", ->
|
||||||
inputs = ['sent', 'all', 'archive', 'drafts']
|
inputs = ['all', 'archive', 'drafts']
|
||||||
actualOut = sortedForCategoryNames inputs
|
actualOut = sortedForCategoryNames inputs
|
||||||
expect(actualOut.length).toBe 0
|
expect(actualOut.length).toBe 0
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@ StandardCategories = {
|
||||||
|
|
||||||
LockedCategories = {
|
LockedCategories = {
|
||||||
"sent"
|
"sent"
|
||||||
|
"drafts"
|
||||||
"N1-Snoozed"
|
"N1-Snoozed"
|
||||||
}
|
}
|
||||||
|
|
||||||
HiddenCategories = {
|
HiddenCategories = {
|
||||||
"sent"
|
|
||||||
"drafts"
|
"drafts"
|
||||||
"all"
|
"all"
|
||||||
"archive"
|
"archive"
|
||||||
|
|
|
@ -305,14 +305,17 @@ class CategoryMailboxPerspective extends MailboxPerspective
|
||||||
|
|
||||||
receiveThreads: (threadsOrIds) =>
|
receiveThreads: (threadsOrIds) =>
|
||||||
FocusedPerspectiveStore = require './flux/stores/focused-perspective-store'
|
FocusedPerspectiveStore = require './flux/stores/focused-perspective-store'
|
||||||
currentCategories = FocusedPerspectiveStore.current().categories()
|
current= FocusedPerspectiveStore.current()
|
||||||
|
|
||||||
# This assumes that the we don't have more than one category per accountId
|
# This assumes that the we don't have more than one category per accountId
|
||||||
# attached to this perspective
|
# attached to this perspective
|
||||||
DatabaseStore.modelify(Thread, threadsOrIds).then (threads) =>
|
DatabaseStore.modelify(Thread, threadsOrIds).then (threads) =>
|
||||||
tasks = TaskFactory.tasksForApplyingCategories
|
tasks = TaskFactory.tasksForApplyingCategories
|
||||||
threads: threads
|
threads: threads
|
||||||
categoriesToRemove: (accountId) -> _.filter(currentCategories, _.matcher({accountId}))
|
categoriesToRemove: (accountId) ->
|
||||||
|
if current.categoriesSharedName() in Category.LockedCategoryNames
|
||||||
|
return []
|
||||||
|
return _.filter(current.categories(), _.matcher({accountId}))
|
||||||
categoriesToAdd: (accountId) => [_.findWhere(@_categories, {accountId})]
|
categoriesToAdd: (accountId) => [_.findWhere(@_categories, {accountId})]
|
||||||
Actions.queueTasks(tasks)
|
Actions.queueTasks(tasks)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue