Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog/unreleased/92667
-rw-r--r--src/gui/models/activitylistmodel.cpp13
2 files changed, 19 insertions, 1 deletions
diff --git a/changelog/unreleased/9266 b/changelog/unreleased/9266
new file mode 100644
index 000000000..af3944746
--- /dev/null
+++ b/changelog/unreleased/9266
@@ -0,0 +1,7 @@
+Bugfix: Do not show Activity tab if server app is disabled or uninstalled
+
+The Activity app API nowadays returns error responses in case the app is disabled or uninstalled.
+This new behavior is now supported in the client.
+
+https://github.com/owncloud/client/issues/9260
+https://github.com/owncloud/client/pull/9266
diff --git a/src/gui/models/activitylistmodel.cpp b/src/gui/models/activitylistmodel.cpp
index 0d269708e..b294361b1 100644
--- a/src/gui/models/activitylistmodel.cpp
+++ b/src/gui/models/activitylistmodel.cpp
@@ -189,10 +189,21 @@ void ActivityListModel::startFetchJob(AccountState *ast)
}
JsonApiJob *job = new JsonApiJob(ast->account(), QStringLiteral("ocs/v2.php/cloud/activity"), this);
QObject::connect(job, &JsonApiJob::jsonReceived,
- this, [ast, this](const QJsonDocument &json, int statusCode) {
+ this, [job, ast, this](const QJsonDocument &json, int statusCode) {
_currentlyFetching.remove(ast);
const auto activities = json.object().value(QStringLiteral("ocs")).toObject().value(QStringLiteral("data")).toArray();
+ /*
+ * in case the activity app is disabled or not installed, the server returns an empty 500 response instead of a response
+ * with the expected status code 999
+ * we are not entirely sure when this has changed, but it is likely that there is a regression in the activity addon
+ * to support this new behavior, we have to fake the expected status code
+ */
+ if (job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
+ emit activityJobStatusCode(ast, 999);
+ return;
+ }
+
ActivityList list;
list.reserve(activities.size());
for (const auto &activ : activities) {