[MNT-24334] allow to delete or move on search result page (#3898)

This commit is contained in:
tamaragruszka 2024-06-19 11:32:47 +02:00 committed by GitHub
parent 85cad50a62
commit 4f41b96695
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View File

@ -793,18 +793,15 @@ describe('app.evaluators', () => {
expect(app.canDeleteSelection(context)).toBeFalse();
});
it('should return false when user is in trashcan, library or search results page', () => {
it('should return false when user is in trashcan or library', () => {
context.selection.isEmpty = false;
context.navigation.url = '/trashcan/tets';
context.navigation.url = '/trashcan/test';
expect(app.canDeleteSelection(context)).toBeFalse();
context.navigation.url = '/test/libraries';
expect(app.canDeleteSelection(context)).toBeFalse();
context.navigation.url = '/search-libraries/tets';
expect(app.canDeleteSelection(context)).toBeFalse();
context.navigation.url = '/search/tets';
context.navigation.url = '/search-libraries/test';
expect(app.canDeleteSelection(context)).toBeFalse();
});
@ -815,6 +812,12 @@ describe('app.evaluators', () => {
expect(app.canDeleteSelection(context)).toBeFalse();
});
it('should return true when user is in search result page', () => {
context.selection.isEmpty = false;
context.navigation.url = '/search/test';
expect(app.canDeleteSelection(context)).toBeTrue();
});
it('should return true when user is in favorites', () => {
context.selection.isEmpty = false;
context.navigation.url = '/favorites/test';

View File

@ -67,6 +67,7 @@ export const supportedExtensions = {
vstx: 'ms-visio',
vstm: 'ms-visio'
};
/* cspell:enable */
export function getFileExtension(fileName: string): string | null {
@ -182,7 +183,7 @@ export function isShared(context: RuleContext): boolean {
* JSON ref: `app.selection.canDelete`
*/
export function canDeleteSelection(context: RuleContext): boolean {
if (navigation.isNotTrashcan(context) && navigation.isNotLibraries(context) && navigation.isNotSearchResults(context) && hasSelection(context)) {
if (navigation.isNotTrashcan(context) && navigation.isNotLibraries(context) && hasSelection(context)) {
if (hasLockedFiles(context)) {
return false;
}