Gracefully handle deleted notifications

Security notifications seem to get automatically deleted by GitHub 
sometimes
This commit is contained in:
Andrew Nesbitt 2018-08-19 20:13:05 +01:00
Родитель 1a0db2f5c1
Коммит 28e24c9ac0
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -86,7 +86,7 @@ class Notification < ApplicationRecord
conn.patch "notifications/threads/#{n.github_id}"
end
end
rescue Octokit::Forbidden
rescue Octokit::Forbidden, Octokit::NotFound
# one or more notifications are for repos the user no longer has access to
end
where(id: unread.map(&:id)).update_all(unread: false)