From 981a4ee2407fdb6d2cbbd8ed1f2a282f691bb7fd Mon Sep 17 00:00:00 2001 From: Camila San Date: Thu, 9 May 2019 22:11:25 +0200 Subject: [PATCH 1/3] Adds parameter to retrieve shares with its reshares. If the initiator or the recipient is not the current user, show the list of sharees without any options to edit it. Minor change: updates api to v2. Signed-off-by: Camila San --- src/gui/ocsshareejob.cpp | 2 +- src/gui/ocssharejob.cpp | 3 ++- src/gui/shareusergroupwidget.cpp | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/ocsshareejob.cpp b/src/gui/ocsshareejob.cpp index 0d1b6d44b..ced73800f 100644 --- a/src/gui/ocsshareejob.cpp +++ b/src/gui/ocsshareejob.cpp @@ -21,7 +21,7 @@ namespace OCC { OcsShareeJob::OcsShareeJob(AccountPtr account) : OcsJob(account) { - setPath("ocs/v1.php/apps/files_sharing/api/v1/sharees"); + setPath("ocs/v2.php/apps/files_sharing/api/v1/sharees"); connect(this, &OcsJob::jobFinished, this, &OcsShareeJob::jobDone); } diff --git a/src/gui/ocssharejob.cpp b/src/gui/ocssharejob.cpp index 520225461..15884e012 100644 --- a/src/gui/ocssharejob.cpp +++ b/src/gui/ocssharejob.cpp @@ -24,7 +24,7 @@ namespace OCC { OcsShareJob::OcsShareJob(AccountPtr account) : OcsJob(account) { - setPath("ocs/v1.php/apps/files_sharing/api/v1/shares"); + setPath("ocs/v2.php/apps/files_sharing/api/v1/shares"); connect(this, &OcsJob::jobFinished, this, &OcsShareJob::jobDone); } @@ -33,6 +33,7 @@ void OcsShareJob::getShares(const QString &path) setVerb("GET"); addParam(QString::fromLatin1("path"), path); + addParam(QString::fromLatin1("reshares"), QString("true")); addPassStatusCode(404); start(); diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp index 6f85809d9..27d80ed78 100644 --- a/src/gui/shareusergroupwidget.cpp +++ b/src/gui/shareusergroupwidget.cpp @@ -420,6 +420,13 @@ ShareUserLine::ShareUserLine(QSharedPointer share, _permissionReshare->setVisible(false); } + //If the initiator is not you. And the recipient is not you. Show it without any options. + if(share->account()->id() != share->getId() && share->account()->davUser() != share->getShareWith()->shareWith()){ + _ui->permissionsEdit->hide(); + _ui->permissionToolButton->hide(); + _ui->deleteShareButton->hide(); + } + loadAvatar(); } From 4f0ff154d3e14cd967a5841fb5b108a24b5d4a95 Mon Sep 17 00:00:00 2001 From: Camila San Date: Fri, 10 May 2019 16:56:03 +0200 Subject: [PATCH 2/3] Display sharees on the first show of the share dialog. It was displaying them only when the current user would edit the share. Signed-off-by: Camila San --- src/gui/shareusergroupwidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp index 27d80ed78..d576b1edb 100644 --- a/src/gui/shareusergroupwidget.cpp +++ b/src/gui/shareusergroupwidget.cpp @@ -202,6 +202,7 @@ void ShareUserGroupWidget::slotSharesFetched(const QList> connect(s, &ShareUserLine::visualDeletionDone, this, &ShareUserGroupWidget::getShares); s->setBackgroundRole(layout->count() % 2 == 0 ? QPalette::Base : QPalette::AlternateBase); layout->addWidget(s); + s->setVisible(true); x++; if (x <= 3) { From 9ff1a30dc4fc8e0155cd5bf5e69118d0fca70bfe Mon Sep 17 00:00:00 2001 From: Camila San Date: Fri, 10 May 2019 16:58:54 +0200 Subject: [PATCH 3/3] Display error when current user is not allowed to reshare file/folder. Signed-off-by: Camila San --- src/gui/sharedialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index 4a62f5885..57126988b 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -271,6 +271,7 @@ void ShareDialog::showSharingUi() auto label = new QLabel(this); label->setText(tr("The file can not be shared because it was shared without sharing permission.")); label->setWordWrap(true); + _ui->verticalLayout->insertWidget(1, label); return; }