Fix notification system to use the new tuple correctly
This commit is contained in:
parent
9f4ffca736
commit
bf3e941d7f
5 changed files with 28 additions and 72 deletions
|
@ -98,7 +98,7 @@ class QuayNotificationMethod(NotificationMethod):
|
|||
return (True, 'Unknown organization %s' % target_info['name'], None)
|
||||
|
||||
# Only repositories under the organization can cause notifications to that org.
|
||||
if target_info['name'] != repository.namespace_user.username:
|
||||
if target_info['name'] != repository.namespace_name:
|
||||
return (False, 'Organization name must match repository namespace')
|
||||
|
||||
return (True, None, [target])
|
||||
|
@ -106,8 +106,7 @@ class QuayNotificationMethod(NotificationMethod):
|
|||
# Lookup the team.
|
||||
org_team = None
|
||||
try:
|
||||
org_team = model.team.get_organization_team(repository.namespace_user.username,
|
||||
target_info['name'])
|
||||
org_team = model.team.get_organization_team(repository.namespace_name, target_info['name'])
|
||||
except model.InvalidTeamException:
|
||||
# Probably deleted.
|
||||
return (True, 'Unknown team %s' % target_info['name'], None)
|
||||
|
@ -143,7 +142,7 @@ class EmailMethod(NotificationMethod):
|
|||
if not email:
|
||||
raise CannotValidateNotificationMethodException('Missing e-mail address')
|
||||
|
||||
record = model.repository.get_email_authorized_for_repo(repository.namespace_user.username,
|
||||
record = model.repository.get_email_authorized_for_repo(repository.namespace_name,
|
||||
repository.name, email)
|
||||
if not record or not record.confirmed:
|
||||
raise CannotValidateNotificationMethodException('The specified e-mail address '
|
||||
|
@ -221,7 +220,7 @@ class FlowdockMethod(NotificationMethod):
|
|||
if not token:
|
||||
return
|
||||
|
||||
owner = model.user.get_user_or_org(notification_obj.repository.namespace_user.username)
|
||||
owner = model.user.get_user_or_org(notification_obj.repository.namespace_name)
|
||||
if not owner:
|
||||
# Something went wrong.
|
||||
return
|
||||
|
@ -234,7 +233,7 @@ class FlowdockMethod(NotificationMethod):
|
|||
'subject': event_handler.get_summary(notification_data['event_data'], notification_data),
|
||||
'content': event_handler.get_message(notification_data['event_data'], notification_data),
|
||||
'from_name': owner.username,
|
||||
'project': (notification_obj.repository.namespace_user.username + ' ' +
|
||||
'project': (notification_obj.repository.namespace_name + ' ' +
|
||||
notification_obj.repository.name),
|
||||
'tags': ['#' + event_handler.event_name()],
|
||||
'link': notification_data['event_data']['homepage']
|
||||
|
@ -277,7 +276,7 @@ class HipchatMethod(NotificationMethod):
|
|||
if not token or not room_id:
|
||||
return
|
||||
|
||||
owner = model.user.get_user_or_org(notification_obj.repository.namespace_user.username)
|
||||
owner = model.user.get_user_or_org(notification_obj.repository.namespace_name)
|
||||
if not owner:
|
||||
# Something went wrong.
|
||||
return
|
||||
|
@ -389,7 +388,7 @@ class SlackMethod(NotificationMethod):
|
|||
if not url:
|
||||
return
|
||||
|
||||
owner = model.user.get_user_or_org(notification_obj.repository.namespace_user.username)
|
||||
owner = model.user.get_user_or_org(notification_obj.repository.namespace_name)
|
||||
if not owner:
|
||||
# Something went wrong.
|
||||
return
|
||||
|
|
Reference in a new issue