[ACA-2174][ACA-2173] Shared / Favorites - edit offline (#1341)

* edit offline

* try to fix test for viewer - password protected file

* bug: Edit in Microsoft Office action is displayed in Shared Files for a locked file
move Shared Files workaround down in the file to fix this

* remove some workarounds, update some comments

* remove other workarounds, make some tests independent, enable lock icon on Search results

* forgotten change

* remove another workaround

Co-authored-by: Adina Parpalita <adina.parpalita@ness.com>
This commit is contained in:
Cilibiu Bogdan
2020-02-17 16:02:25 +02:00
committed by GitHub
parent c37e5f431e
commit 1a16d74b62
15 changed files with 180 additions and 215 deletions

View File

@@ -152,7 +152,7 @@ export function canDeleteSelection(context: RuleContext): boolean {
return false;
}
// temp workaround for Search api
// temp workaround for Favorites api
if (navigation.isFavorites(context)) {
return true;
}
@@ -391,7 +391,7 @@ export function canLockFile(context: RuleContext): boolean {
/**
* Checks if user can unlock selected file.
* JSON ref: `app.selection.file.canLock`
* JSON ref: `app.selection.file.canUnlock`
*/
export function canUnlockFile(context: RuleContext): boolean {
const { file } = context.selection;
@@ -508,9 +508,6 @@ export function canToggleEditOffline(context: RuleContext): boolean {
return [
hasFileSelected(context),
navigation.isNotTrashcan(context),
navigation.isNotFavorites(context) ||
navigation.isFavoritesPreview(context),
navigation.isNotSharedFiles(context) || navigation.isSharedPreview(context),
canLockFile(context) || canUnlockFile(context)
].every(Boolean);
}

View File

@@ -53,19 +53,6 @@ export function canOpenWithOffice(
return false;
}
// workaround for Shared files
if (
context.navigation &&
context.navigation.url &&
context.navigation.url.startsWith('/shared')
) {
if (file.entry.hasOwnProperty('allowableOperationsOnTarget')) {
return context.permissions.check(file, ['update'], {
target: 'allowableOperationsOnTarget'
});
}
}
if (!file.entry.properties) {
return false;
}
@@ -107,5 +94,18 @@ export function canOpenWithOffice(
return false;
}
// workaround for Shared files
if (
context.navigation &&
context.navigation.url &&
context.navigation.url.startsWith('/shared')
) {
if (file.entry.hasOwnProperty('allowableOperationsOnTarget')) {
return context.permissions.check(file, ['update'], {
target: 'allowableOperationsOnTarget'
});
}
}
return context.permissions.check(file, ['update']);
}