Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch "shared with me" information separately #7744

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/gui/ocssharejob.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check notice on line 1 in src/gui/ocssharejob.cpp

View workflow job for this annotation

GitHub Actions / build

Run clang-format on src/gui/ocssharejob.cpp

File src/gui/ocssharejob.cpp does not conform to Custom style guidelines. (lines 210)
* Copyright (C) by Roeland Jago Douma <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -34,7 +34,6 @@

addParam(QString::fromLatin1("path"), path);
addParam(QString::fromLatin1("reshares"), QString("true"));
addParam(QString::fromLatin1("shared_with_me"), QString("true"));

for (auto it = std::cbegin(params); it != std::cend(params); ++it) {
addParam(it.key(), it.value());
Expand Down Expand Up @@ -208,10 +207,13 @@
start();
}

void OcsShareJob::getSharedWithMe()
void OcsShareJob::getSharedWithMe(const QString& path)

Check warning on line 210 in src/gui/ocssharejob.cpp

View workflow job for this annotation

GitHub Actions / build

src/gui/ocssharejob.cpp:210:19 [readability-convert-member-functions-to-static]

method 'getSharedWithMe' can be made static
{
setVerb("GET");
addParam(QLatin1String("shared_with_me"), QLatin1String("true"));

addParam(QString::fromLatin1("path"), path);
addParam(QString::fromLatin1("shared_with_me"), QString("true"));

start();
}

Expand Down
3 changes: 2 additions & 1 deletion src/gui/ocssharejob.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*

Check notice on line 1 in src/gui/ocssharejob.h

View workflow job for this annotation

GitHub Actions / build

Run clang-format on src/gui/ocssharejob.h

File src/gui/ocssharejob.h does not conform to Custom style guidelines. (lines 140)
* Copyright (C) by Roeland Jago Douma <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -135,8 +135,9 @@

/**
* Returns information on the items shared with the current user.
* @param path Path to request shares for (default all shares)
*/
void getSharedWithMe();
void getSharedWithMe(const QString& path = "");

static const QString _pathForSharesRequest;

Expand Down
5 changes: 5 additions & 0 deletions src/gui/sharemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,11 @@ void ShareManager::fetchShares(const QString &path)
connect(job, &OcsShareJob::shareJobFinished, this, &ShareManager::slotSharesFetched);
connect(job, &OcsJob::ocsError, this, &ShareManager::slotOcsError);
job->getShares(path);

auto *sharedWithMeJob = new OcsShareJob(_account);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto *sharedWithMeJob = new OcsShareJob(_account);
const auto sharedWithMeJob = new OcsShareJob(_account);

connect(sharedWithMeJob, &OcsShareJob::shareJobFinished, this, &ShareManager::slotSharesFetched);
connect(sharedWithMeJob, &OcsJob::ocsError, this, &ShareManager::slotOcsError);
sharedWithMeJob->getSharedWithMe(path);
}

void ShareManager::slotSharesFetched(const QJsonDocument &reply)
Expand Down
Loading