Unverified Commit 7e4846ee authored by Camila's avatar Camila Committed by Michael Schuster

Display the correct default permissions when creating a share.

- The default displayed was not in sync with the server because
the client was setting permissions when creating a share while it
should get the default permissions from the server to display it to the
user first.
Signed-off-by: default avatarCamila <hello@camila.codes>
(cherry picked from commit d7a13672923a638ed53871a4d61c76a33b701b06)
Signed-off-by: default avatarMichael Schuster <michael@schuster.ms>
parent bc224467
......@@ -138,9 +138,6 @@ void OcsShareJob::createShare(const QString &path,
addParam(QString::fromLatin1("path"), path);
addParam(QString::fromLatin1("shareType"), QString::number(shareType));
addParam(QString::fromLatin1("shareWith"), shareWith);
if (!(permissions & SharePermissionDefault)) {
addParam(QString::fromLatin1("permissions"), QString::number(permissions));
}
start();
}
......
......@@ -28,7 +28,7 @@ enum SharePermission {
SharePermissionCreate = 4,
SharePermissionDelete = 8,
SharePermissionShare = 16,
SharePermissionDefault = 1 << 30
SharePermissionDefault = 31
};
Q_DECLARE_FLAGS(SharePermissions, SharePermission)
Q_DECLARE_OPERATORS_FOR_FLAGS(SharePermissions)
......
......@@ -206,7 +206,8 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
}
// the owner of the file that shared it first
if(x == 0 && !share->getUidOwner().isEmpty()){
// leave out if it's the current user
if(x == 0 && !share->getUidOwner().isEmpty() && !(share->getUidOwner() == _account->credentials()->user())) {
_ui->mainOwnerLabel->setText(QString("Shared with you by ").append(share->getOwnerDisplayName()));
}
......@@ -317,7 +318,8 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
} else {
// Default permissions on creation
int permissions = SharePermissionRead | SharePermissionUpdate;
int permissions = SharePermissionCreate | SharePermissionUpdate
| SharePermissionDelete | SharePermissionShare;
_manager->createShare(_sharePath, Share::ShareType(sharee->type()),
sharee->shareWith(), SharePermission(permissions));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment