diff --git a/resources/i18n/en.json5 b/resources/i18n/en.json5 index a82b4d6593..decad7309b 100644 --- a/resources/i18n/en.json5 +++ b/resources/i18n/en.json5 @@ -1455,9 +1455,9 @@ "profile.security.form.label.passwordrepeat": "Retype to confirm", - "profile.security.form.notifications.success.content": "Successfully changed password.", + "profile.security.form.notifications.success.content": "Your changes to the password were saved.", - "profile.security.form.notifications.success.title": "Password changed", + "profile.security.form.notifications.success.title": "Password saved", "profile.security.form.notifications.error.title": "Error changing passwords", diff --git a/src/app/core/cache/server-sync-buffer.effects.ts b/src/app/core/cache/server-sync-buffer.effects.ts index 96cd8496d2..fd398f2971 100644 --- a/src/app/core/cache/server-sync-buffer.effects.ts +++ b/src/app/core/cache/server-sync-buffer.effects.ts @@ -104,9 +104,8 @@ export class ServerSyncBufferEffects { map((entry: ObjectCacheEntry) => { if (isNotEmpty(entry.patches)) { const flatPatch: Operation[] = [].concat(...entry.patches.map((patch) => patch.operations)); - const objectPatch = flatPatch.filter((op: Operation) => op.path.startsWith('/metadata')); - if (isNotEmpty(objectPatch)) { - this.requestService.configure(new PatchRequest(this.requestService.generateRequestId(), href, objectPatch)); + if (isNotEmpty(flatPatch)) { + this.requestService.configure(new PatchRequest(this.requestService.generateRequestId(), href, flatPatch)); } } return new ApplyPatchObjectCacheAction(href); diff --git a/src/app/core/data/data.service.ts b/src/app/core/data/data.service.ts index a7528bae0c..3e67675290 100644 --- a/src/app/core/data/data.service.ts +++ b/src/app/core/data/data.service.ts @@ -44,7 +44,7 @@ import { FindByIDRequest, FindListOptions, FindListRequest, - GetRequest, PatchRequest + GetRequest } from './request.models'; import { RequestEntry } from './request.reducer'; import { RequestService } from './request.service'; @@ -337,32 +337,6 @@ export abstract class DataService { this.objectCache.addPatch(href, operations); } - /** - * Send out an immediate patch request, instead of adding to the object cache first - * This is useful in cases where you need the returned response and an object cache update is not needed - * @param dso The dso to send the patch to - * @param operations The patch operations - */ - immediatePatch(dso: T, operations: Operation[]): Observable { - const requestId = this.requestService.generateRequestId(); - - const hrefObs = this.halService.getEndpoint(this.linkPath).pipe( - map((endpoint: string) => this.getIDHref(endpoint, dso.uuid))); - - hrefObs.pipe( - find((href: string) => hasValue(href)), - map((href: string) => { - const request = new PatchRequest(requestId, href, operations); - this.requestService.configure(request); - }) - ).subscribe(); - - return this.requestService.getByUUID(requestId).pipe( - find((request: RequestEntry) => request.completed), - map((request: RequestEntry) => request.response) - ); - } - /** * Add a new patch to the object cache * The patch is derived from the differences between the given object and its version in the object cache diff --git a/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.ts b/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.ts index 5885cc48db..d7f6213dc6 100644 --- a/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.ts +++ b/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.ts @@ -116,18 +116,11 @@ export class ProfilePageSecurityFormComponent implements OnInit { } if (passEntered) { const operation = Object.assign({ op: 'replace', path: '/password', value: pass }); - this.epersonService.immediatePatch(this.user, [operation]).subscribe((response: RestResponse) => { - if (response.isSuccessful) { - this.notificationsService.success( - this.translate.instant(this.NOTIFICATIONS_PREFIX + 'success.title'), - this.translate.instant(this.NOTIFICATIONS_PREFIX + 'success.content') - ); - } else { - this.notificationsService.error( - this.translate.instant(this.NOTIFICATIONS_PREFIX + 'error.title'), (response as ErrorResponse).errorMessage - ); - } - }); + this.epersonService.patch(this.user.self, [operation]); + this.notificationsService.success( + this.translate.instant(this.NOTIFICATIONS_PREFIX + 'success.title'), + this.translate.instant(this.NOTIFICATIONS_PREFIX + 'success.content') + ); } return passEntered;