Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
fix alert email subject format
Browse files Browse the repository at this point in the history
  • Loading branch information
lehanhua committed Mar 10, 2017
1 parent 6a63b30 commit 9d29a95
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion alerts/email_alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def send(self, alert=None, to_email=None, from_email=None):
self.html = alert.message_html

msg = MIMEMultipart('alternative')
msg['Subject'] = "Providence Alert: " + self.subject
msg['Subject'] = "" + self.subject
msg['From'] = self.from_email
msg['To'] = self.emails

Expand Down
5 changes: 4 additions & 1 deletion plugins/basic_plugin_watcher/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class Plugin(base.Plugin):
# basic configurations
configuration = config.Configuration('config.json')
EMAIL_ALERT_RECIPIENTS = configuration.get(('email', 'to'))
EMAIL_ALERT_SUBJECT = configuration.get(('email', 'subject'))
if EMAIL_ALERT_SUBJECT is None or EMAIL_ALERT_SUBJECT is '':
EMAIL_ALERT_SUBJECT = '[Providence Email Alert]'

# some regex filename constants
JAVA_SOURCE_FILE_PATTERN = "\.java$"
Expand Down Expand Up @@ -98,7 +101,7 @@ def send_alert(self, repo_patch, repo_commit, subject, offending_line):
filename = 'NOFILE'
if repo_patch != None:
filename = repo_patch.filename
subject = "[Providence Email Alert] - " + subject + ' in ' + repo_commit.identifier
subject = self.EMAIL_ALERT_SUBJECT + " " + subject + ' in ' + repo_commit.identifier

# skip if the alert is duplicate
if url + filename + subject + offending_line == Plugin.last_alert:
Expand Down
5 changes: 4 additions & 1 deletion plugins/forcedotcom_base_watcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class ForceDotComBasePlugin(base.Plugin):
# basic configurations
configuration = config.Configuration('config.json')
EMAIL_ALERT_RECIPIENTS = configuration.get(('email', 'to'))
EMAIL_ALERT_SUBJECT = configuration.get(('email', 'subject'))
if EMAIL_ALERT_SUBJECT is None or EMAIL_ALERT_SUBJECT is '':
EMAIL_ALERT_SUBJECT = '[Providence Email Alert]'

# some regex filename constants
AURA_CMP_UI_SOURCE_FILE_PATTERN = "^((?<!auradocs)(?<!outputRichText).)*\.cmp$"
Expand Down Expand Up @@ -95,7 +98,7 @@ def send_alert(self, repo_patch, repo_commit, subject, offending_line):
filename = 'NOFILE'
if repo_patch != None:
filename = repo_patch.filename
subject = "[Providence Email Alert] - " + subject + ' in ' + repo_commit.identifier
subject = self.EMAIL_ALERT_SUBJECT + " " + subject + ' in ' + repo_commit.identifier

# skip if the alert is duplicate
if url + filename + subject + offending_line == ForceDotComBasePlugin.last_alert:
Expand Down

0 comments on commit 9d29a95

Please sign in to comment.