Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,6 @@ require_auth: False
# username: 'sAMAccountName'
# full_name: 'displayName'
# mail: 'mail'
# pushover: 'pushover'
# mobile: 'mobile'
# image_url: 'https://image.example.com/api/%s/picture'
2 changes: 1 addition & 1 deletion db/schema.v0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ CREATE TABLE IF NOT EXISTS `contact_mode` (
-- Initialize contact modes
-- -----------------------------------------------------
INSERT IGNORE INTO `contact_mode` (`name`)
VALUES ('email'), ('sms'), ('call'), ('slack'), ('teams_messenger');
VALUES ('email'), ('sms'), ('call'), ('slack'), ('teams_messenger'), ('pushover');

-- -----------------------------------------------------
-- Table `user_contact`
Expand Down
1 change: 1 addition & 0 deletions src/oncall/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
SMS_SUPPORT = 'sms'
CALL_SUPPORT = 'call'
SLACK_SUPPORT = 'slack'
PUSHOVER_SUPPORT = 'pushover'
ROCKET_SUPPORT = 'rocketchat'
TEAMS_SUPPORT = 'teams_messenger'

Expand Down
4 changes: 2 additions & 2 deletions src/oncall/messengers/iris_messenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# See LICENSE in the project root for license information.


from oncall.constants import EMAIL_SUPPORT, SMS_SUPPORT, CALL_SUPPORT, SLACK_SUPPORT
from oncall.constants import EMAIL_SUPPORT, SMS_SUPPORT, CALL_SUPPORT, SLACK_SUPPORT, PUSHOVER_SUPPORT
from irisclient import IrisClient


class iris_messenger(object):
supports = frozenset([EMAIL_SUPPORT, SMS_SUPPORT, CALL_SUPPORT, SLACK_SUPPORT])
supports = frozenset([EMAIL_SUPPORT, SMS_SUPPORT, CALL_SUPPORT, SLACK_SUPPORT, PUSHOVER_SUPPORT])

def __init__(self, config):
self.iris_client = IrisClient(config['application'], config['iris_api_key'], config['api_host'])
Expand Down
4 changes: 4 additions & 0 deletions src/oncall/ui/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ <h4 class="modal-title">Calendar Timezones</h4>
{{/isEqual}}
</li>
<li> Slack: <a>{{getUserInfo this @root.users 'contacts.slack'}}</a> </li>
<li> Pushover: <a>{{getUserInfo this @root.users 'contacts.pushover'}}</a> </li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most people will not be using pushover, it looks like this code will leave a bunch of empty pushover related ui elements, these should be made conditional on pushover data existing.

<li> E-Mail: <a target="_blank" href="mailto:{{getUserInfo this @root.users 'contacts.email'}}"> {{getUserInfo this @root.users 'contacts.email'}} </a> </li>
</ul>
</div>
Expand Down Expand Up @@ -570,6 +571,7 @@ <h4>On Call Now </h4>
<li> Call: {{#if user_contacts.call}} <a href="tel:{{user_contacts.call}}"> {{user_contacts.call}} </a> {{else}} <span class="error-text">No number found!</span> {{/if}} </li>
<li> SMS: {{#if user_contacts.sms}} <a href="tel:{{user_contacts.sms}}"> {{user_contacts.sms}} </a> {{else}} <span class="error-text">No number found!</span> {{/if}} </li>
<li> Slack: <a>{{user_contacts.slack}}</a> </li>
<li> Pushover: <a>{{user_contacts.pushover}}</a> </li>
<li> E-Mail: <a target="_blank" href="mailto:{{user_contacts.email}}"> {{user_contacts.email}} </a> </li>
</ul>
<ul class="border-top card-content">
Expand Down Expand Up @@ -1334,6 +1336,7 @@ <h4>
<li> <span class="light"> Call </span> {{#if user.contacts.call}} <a href="tel:{{user.contacts.call}}" target="_blank"> {{user.contacts.call}} </a> {{else}} <span class="error-text">No number found!</span> {{/if}} </li>
<li> <span class="light"> SMS </span> {{#if user.contacts.sms}} <a href="tel:{{user.contacts.sms}}" target="_blank"> {{user.contacts.sms}} </a> {{else}} <span class="error-text">No number found!</span> {{/if}} </li>
<li> <span class="light"> Slack </span> <a> {{user.contacts.slack}} </a> </li>
<li> <span class="light"> Pushover </span> <a> {{user.contacts.pushover}} </a> </li>
<span class="close remove-card-item" data-admin-action="true" data-toggle="modal" data-target="#confirm-action-modal" data-modal-action="oncall.team.info.removeCardItem" data-modal-title="Remove {{user.full_name}}" data-modal-content="Delete {{user.full_name}} from roster?">
<i class="svg-icon svg-icon-trash">
<svg xmlns="http://www.w3.org/2000/svg" width="14px" height="14px" viewBox="0 0 8 8">
Expand Down Expand Up @@ -1373,6 +1376,7 @@ <h4>
{{/isEqual}}
</li>
<li> <span class="light"> Slack </span> <a> {{getUserInfo this @root.users 'contacts.slack'}} </a></li>
<li> <span class="light"> Pushover </span> <a> {{getUserInfo this @root.users 'contacts.pushover'}} </a></li>
<span class="close remove-card-item" data-admin-action="true" data-toggle="modal" data-target="#confirm-action-modal" data-modal-action="oncall.team.info.removeCardItem" data-modal-title="Remove {{getUserInfo this @root.users 'full_name'}}" data-modal-content="Delete {{getUserInfo this @root.users 'full_name'}} from roster?">
<i class="svg-icon svg-icon-trash">
<svg xmlns="http://www.w3.org/2000/svg" width="14px" height="14px" viewBox="0 0 8 8">
Expand Down
3 changes: 2 additions & 1 deletion src/oncall/user_sync/ldap_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def fetch_ldap():
name = name.decode("utf-8")
mobile = ldap_dict.get(LDAP_SETTINGS['attrs']['mobile'])
mail = ldap_dict.get(LDAP_SETTINGS['attrs']['mail'])
pushover = ldap_dict.get(LDAP_SETTINGS['attrs']['pushover'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like it could potentially cause keyerror exceptions if there is no pushover data in ldap. The app should look and behave as it does now if there is no pushover data defined anywhere in ldap, iris, or oncall.


if mobile:
try:
Expand All @@ -158,7 +159,7 @@ def fetch_ldap():
else:
slack = None

contacts = {'call': mobile, 'sms': mobile, 'email': mail, 'slack': slack, 'name': name}
contacts = {'call': mobile, 'sms': mobile, 'email': mail, 'slack': slack, 'pushover': pushover, 'name': name}
dn_map[dn] = username
users[username] = contacts

Expand Down