fix(phishing-detection): undefined messages no longer throws exception

Summary: fixes T4078

Test Plan: manual

Reviewers: bengotow

Maniphest Tasks: T4078

Differential Revision: https://phab.nylas.com/D2111
This commit is contained in:
dillon 2015-10-05 14:36:48 -07:00
parent 9803c0d5f9
commit 6cf6f9087e
2 changed files with 4 additions and 4 deletions

View file

@ -55,7 +55,7 @@ class PhishingIndicator extends React.Component
# This package's strategy to ascertain whether or not the email is a
# phishing attempt boils down to checking the `replyTo` attributes on
# `Message` models from `MessageStore`.
if message.replyTo? and message.replyTo.length != 0
if message?.replyTo? and message.replyTo.length != 0
# The `from` and `replyTo` attributes on `Message` models both refer to
# arrays of `Contact` models, which in turn have `email` attributes.
@ -65,9 +65,9 @@ class PhishingIndicator extends React.Component
# This is our core logic for our whole package! If the `from` and
# `replyTo` emails are different, then we want to show a phishing warning.
if reply_to isnt from
return [from, reply_to]
return [from, reply_to]
return [null, null];
return [null, null]
module.exports =

View file

@ -1,6 +1,6 @@
{
"name": "phishing",
"version": "0.2.0",
"version": "0.2.1",
"main": "./lib/main",
"description": "An example package for Nylas Mail that translates drafts into other languages using the Yandex API.",
"license": "Proprietary",