From 7d13a1d8e199b21b917145d52faf7cd7b4f697b3 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Wed, 9 Mar 2016 17:21:59 +0100 Subject: [PATCH] Notifications: Check capabilities if the notifications are enabled If not, do not query for them. --- src/gui/activitywidget.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp index ec01dde743..07bf75d764 100644 --- a/src/gui/activitywidget.cpp +++ b/src/gui/activitywidget.cpp @@ -440,6 +440,15 @@ void ActivityWidget::slotFetchNotifications(AccountState *ptr) return; } + // check if the account has notifications enabled. If the capabilities are + // not yet valid, its assumed that notifications are available. + if( ptr->account() && ptr->account()->capabilities().isValid() ) { + if( ! ptr->account()->capabilities().notificationsAvailable() ) { + qDebug() << "Account" << ptr->account()->displayName() << "does not have notifications enabled."; + return; + } + } + // if the previous notification job has finished, start next. if( !_notificationJob ) { _notificationJob = new JsonApiJob( ptr->account(), QLatin1String("ocs/v2.php/apps/notifications/api/v1/notifications"), this );