X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/a00b27290354eb909f23b851e22036aa02d076a2..refs/heads/master:/src/com/owncloud/android/operations/UnshareOperation.java diff --git a/src/com/owncloud/android/operations/UnshareOperation.java b/src/com/owncloud/android/operations/UnshareOperation.java index 42d25a36..d819abf5 100644 --- a/src/com/owncloud/android/operations/UnshareOperation.java +++ b/src/com/owncloud/android/operations/UnshareOperation.java @@ -67,14 +67,14 @@ public class UnshareOperation extends SyncOperation { mShareType, mShareWith); if (share != null) { + OCFile file = getStorageManager().getFileByPath(mRemotePath); RemoveRemoteShareOperation operation = - new RemoveRemoteShareOperation((int) share.getIdRemoteShared()); + new RemoveRemoteShareOperation((int) share.getRemoteId()); result = operation.execute(client); - if (result.isSuccess() || result.getCode() == ResultCode.SHARE_NOT_FOUND) { - Log_OC.d(TAG, "Share id = " + share.getIdRemoteShared() + " deleted"); + if (result.isSuccess()) { + Log_OC.d(TAG, "Share id = " + share.getRemoteId() + " deleted"); - OCFile file = getStorageManager().getFileByPath(mRemotePath); if (mShareType == ShareType.PUBLIC_LINK) { file.setShareViaLink(false); file.setPublicLink(""); @@ -84,22 +84,18 @@ public class UnshareOperation extends SyncOperation { getSharesWithForAFile(mRemotePath, getStorageManager().getAccount().name); if (sharesWith.size() == 1) { - file.setShareViaUsers(false); + file.setShareWithSharee(false); } } getStorageManager().saveFile(file); getStorageManager().removeShare(share); - if (result.getCode() == ResultCode.SHARE_NOT_FOUND) { - if (existsFile(client, file.getRemotePath())) { - result = new RemoteOperationResult(ResultCode.OK); - } else { - getStorageManager().removeFile(file, true, true); - } - } - } - + } else if (!existsFile(client, file.getRemotePath())) { + // unshare failed because file was deleted before + getStorageManager().removeFile(file, true, true); + } + } else { result = new RemoteOperationResult(ResultCode.SHARE_NOT_FOUND); }