mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 00:06:06 +08:00
fix(sent): Sort sent view by most recent sent message, not received
This commit is contained in:
parent
d4ef6a20e5
commit
aac3198971
|
@ -8,7 +8,7 @@ classNames = require 'classnames'
|
|||
MailImportantIcon,
|
||||
InjectedComponentSet} = require 'nylas-component-kit'
|
||||
|
||||
{Thread} = require 'nylas-exports'
|
||||
{Thread, FocusedPerspectiveStore} = require 'nylas-exports'
|
||||
|
||||
{ThreadArchiveQuickAction,
|
||||
ThreadTrashQuickAction} = require './thread-list-quick-actions'
|
||||
|
@ -20,6 +20,12 @@ ThreadListParticipants = require './thread-list-participants'
|
|||
ThreadListStore = require './thread-list-store'
|
||||
ThreadListIcon = require './thread-list-icon'
|
||||
|
||||
TimestampComponentForPerspective = (thread) ->
|
||||
if FocusedPerspectiveStore.current().isSent()
|
||||
<span className="timestamp">{timestamp(thread.lastMessageSentTimestamp)}</span>
|
||||
else
|
||||
<span className="timestamp">{timestamp(thread.lastMessageReceivedTimestamp)}</span>
|
||||
|
||||
|
||||
c1 = new ListTabular.Column
|
||||
name: "★"
|
||||
|
@ -72,7 +78,7 @@ c3 = new ListTabular.Column
|
|||
c4 = new ListTabular.Column
|
||||
name: "Date"
|
||||
resolver: (thread) =>
|
||||
<span className="timestamp">{timestamp(thread.lastMessageReceivedTimestamp)}</span>
|
||||
TimestampComponentForPerspective(thread)
|
||||
|
||||
c5 = new ListTabular.Column
|
||||
name: "HoverActions"
|
||||
|
@ -111,7 +117,7 @@ cNarrow = new ListTabular.Column
|
|||
{pencil}
|
||||
<span style={flex:1}></span>
|
||||
{attachment}
|
||||
<span className="timestamp">{timestamp(thread.lastMessageReceivedTimestamp)}</span>
|
||||
{TimestampComponentForPerspective(thread)}
|
||||
</div>
|
||||
<MailImportantIcon
|
||||
thread={thread}
|
||||
|
|
|
@ -79,6 +79,11 @@ class Thread extends ModelWithMetadata
|
|||
modelKey: 'lastMessageReceivedTimestamp'
|
||||
jsonKey: 'last_message_received_timestamp'
|
||||
|
||||
'lastMessageSentTimestamp': Attributes.DateTime
|
||||
queryable: true
|
||||
modelKey: 'lastMessageSentTimestamp'
|
||||
jsonKey: 'last_message_sent_timestamp'
|
||||
|
||||
Object.defineProperty @prototype, "labels",
|
||||
enumerable: false
|
||||
get: -> @categories
|
||||
|
|
|
@ -81,19 +81,23 @@ class MailboxPerspective
|
|||
true
|
||||
|
||||
isInbox: =>
|
||||
false
|
||||
@categoriesSharedName() is 'inbox'
|
||||
|
||||
isArchive: =>
|
||||
false
|
||||
isSent: =>
|
||||
@categoriesSharedName() is 'sent'
|
||||
|
||||
isTrash: =>
|
||||
@categoriesSharedName() is 'trash'
|
||||
|
||||
isArchive: =>
|
||||
false
|
||||
|
||||
categories: =>
|
||||
[]
|
||||
|
||||
categoriesSharedName: =>
|
||||
Category.categoriesSharedName(@categories())
|
||||
@_categoriesSharedName ?= Category.categoriesSharedName(@categories())
|
||||
@_categoriesSharedName
|
||||
|
||||
category: =>
|
||||
return null unless @categories().length is 1
|
||||
|
@ -268,6 +272,9 @@ class CategoryMailboxPerspective extends MailboxPerspective
|
|||
.where([Thread.attributes.categories.containsAny(_.pluck(@categories(), 'id'))])
|
||||
.limit(0)
|
||||
|
||||
if @isSent()
|
||||
query.order(Thread.attributes.lastMessageSentTimestamp.descending())
|
||||
|
||||
if @_categories.length > 1 and @accountIds.length < @_categories.length
|
||||
# The user has multiple categories in the same account selected, which
|
||||
# means our result set could contain multiple copies of the same threads
|
||||
|
@ -286,15 +293,9 @@ class CategoryMailboxPerspective extends MailboxPerspective
|
|||
categories: =>
|
||||
@_categories
|
||||
|
||||
isInbox: =>
|
||||
@categoriesSharedName() is 'inbox'
|
||||
|
||||
isArchive: =>
|
||||
_.every(@_categories, (cat) -> cat.isArchive())
|
||||
|
||||
isTrash: =>
|
||||
@categoriesSharedName() is 'trash'
|
||||
|
||||
canReceiveThreadsFromAccountIds: =>
|
||||
super and not _.any @_categories, (c) -> c.isLockedCategory()
|
||||
|
||||
|
|
Loading…
Reference in a new issue