From 6cf6f9087e0da57b71ded77ffe79ff0f5dae89df Mon Sep 17 00:00:00 2001 From: dillon Date: Mon, 5 Oct 2015 14:36:48 -0700 Subject: [PATCH] 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 --- examples/N1-Phishing-Detection/lib/main.cjsx | 6 +++--- examples/N1-Phishing-Detection/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/N1-Phishing-Detection/lib/main.cjsx b/examples/N1-Phishing-Detection/lib/main.cjsx index eb3f1a1b6..35f45ba8a 100644 --- a/examples/N1-Phishing-Detection/lib/main.cjsx +++ b/examples/N1-Phishing-Detection/lib/main.cjsx @@ -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 = diff --git a/examples/N1-Phishing-Detection/package.json b/examples/N1-Phishing-Detection/package.json index 6cf67b30e..b099cd225 100755 --- a/examples/N1-Phishing-Detection/package.json +++ b/examples/N1-Phishing-Detection/package.json @@ -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",