Do not fetch activities if they are not enabled

Fixes #788
Fixes #834

If the activity app is not enabled we should not try to fetch the
activities at all.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-11-19 14:13:51 +01:00
parent a3d1bd3a42
commit 1d0bf08a1c
No known key found for this signature in database
GPG key ID: F941078878347C0C
4 changed files with 21 additions and 3 deletions

View file

@ -291,18 +291,28 @@ void ActivityListModel::combineActivityLists()
endInsertRows();
}
bool ActivityListModel::canFetchActivities() const {
return _accountState->isConnected() && _accountState->account()->capabilities().hasActivities();
}
void ActivityListModel::fetchMore(const QModelIndex &)
{
if (_accountState->isConnected()) {
_activityLists = ActivityList();
_activityLists = ActivityList();
if (canFetchActivities()) {
startFetchJob();
} else {
combineActivityLists();
}
}
void ActivityListModel::slotRefreshActivity()
{
_activityLists.clear();
startFetchJob();
if (canFetchActivities()) {
startFetchJob();
} else {
combineActivityLists();
}
}
void ActivityListModel::slotRemoveAccount()

View file

@ -67,6 +67,7 @@ signals:
private:
void startFetchJob();
void combineActivityLists();
bool canFetchActivities() const;
ActivityList _activityLists;
ActivityList _syncFileItemLists;

View file

@ -103,6 +103,10 @@ bool Capabilities::isValid() const
return !_capabilities.isEmpty();
}
bool Capabilities::hasActivities() const {
return _capabilities.contains("activity");
}
QList<QByteArray> Capabilities::supportedChecksumTypes() const
{
QList<QByteArray> list;

View file

@ -59,6 +59,9 @@ public:
/// returns true if the capabilities are loaded already.
bool isValid() const;
/// return true if the activity app is enabled
bool hasActivities() const;
/**
* Returns the checksum types the server understands.
*