Remove error notification when user deletes repos

Also prevent duplicate notifications of that type.

fixes #493
This commit is contained in:
Matt Jibson 2015-11-04 16:11:15 -05:00
parent 5f49c4da7c
commit 4d81567a0c
3 changed files with 23 additions and 11 deletions

View file

@ -200,10 +200,13 @@ def render_page_template(name, **kwargs):
def check_repository_usage(user_or_org, plan_found):
private_repos = model.user.get_private_repo_count(user_or_org.username)
repos_allowed = plan_found['privateRepos']
if plan_found is None:
repos_allowed = 0
else:
repos_allowed = plan_found['privateRepos']
if private_repos > repos_allowed:
model.notification.create_notification('over_private_usage', user_or_org,
model.notification.create_unique_notification('over_private_usage', user_or_org,
{'namespace': user_or_org.username})
else:
model.notification.delete_notifications_by_kind(user_or_org, 'over_private_usage')