mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 08:16:09 +08:00
fix(contact): add hasSameDomainAsMe method to Contact
This commit is contained in:
parent
0971f67e7f
commit
cb7b3764f5
|
@ -88,7 +88,7 @@ class TimeOverride
|
||||||
|
|
||||||
@_fakeSetInterval = (callback, ms) =>
|
@_fakeSetInterval = (callback, ms) =>
|
||||||
id = ++@intervalCount
|
id = ++@intervalCount
|
||||||
action = ->
|
action = =>
|
||||||
callback()
|
callback()
|
||||||
@intervalTimeouts[id] = @_fakeSetTimeout(action, ms)
|
@intervalTimeouts[id] = @_fakeSetTimeout(action, ms)
|
||||||
@intervalTimeouts[id] = @_fakeSetTimeout(action, ms)
|
@intervalTimeouts[id] = @_fakeSetTimeout(action, ms)
|
||||||
|
|
|
@ -111,6 +111,11 @@ class Contact extends Model
|
||||||
account = AccountStore.accountForEmail(@email)
|
account = AccountStore.accountForEmail(@email)
|
||||||
return account?
|
return account?
|
||||||
|
|
||||||
|
hasSameDomainAsMe: ->
|
||||||
|
for myEmail in AccountStore.emailAddresses()
|
||||||
|
return true if Utils.emailsHaveSameDomain(@email, myEmail)
|
||||||
|
return false
|
||||||
|
|
||||||
isMePhrase: ({includeAccountLabel, forceAccountLabel} = {}) ->
|
isMePhrase: ({includeAccountLabel, forceAccountLabel} = {}) ->
|
||||||
account = AccountStore.accountForEmail(@email)
|
account = AccountStore.accountForEmail(@email)
|
||||||
return null unless account
|
return null unless account
|
||||||
|
|
|
@ -241,6 +241,11 @@ class AccountStore extends NylasStore
|
||||||
accountForId: (id) =>
|
accountForId: (id) =>
|
||||||
@_cachedGetter "accountForId:#{id}", => _.findWhere(@_accounts, {id})
|
@_cachedGetter "accountForId:#{id}", => _.findWhere(@_accounts, {id})
|
||||||
|
|
||||||
|
emailAddresses: ->
|
||||||
|
addresses = _.pluck((@accounts() ? []), "emailAddress")
|
||||||
|
addresses = addresses.concat(_.pluck((@aliases() ? [])), "email")
|
||||||
|
return addresses
|
||||||
|
|
||||||
aliases: =>
|
aliases: =>
|
||||||
@_cachedGetter "aliases", =>
|
@_cachedGetter "aliases", =>
|
||||||
aliases = []
|
aliases = []
|
||||||
|
|
Loading…
Reference in a new issue