mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 02:59:22 +03:00
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:
parent
a3d1bd3a42
commit
1d0bf08a1c
4 changed files with 21 additions and 3 deletions
|
@ -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()
|
||||
|
|
|
@ -67,6 +67,7 @@ signals:
|
|||
private:
|
||||
void startFetchJob();
|
||||
void combineActivityLists();
|
||||
bool canFetchActivities() const;
|
||||
|
||||
ActivityList _activityLists;
|
||||
ActivityList _syncFileItemLists;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue