Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: user workspace validation #2331

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal
/**
* Validate this context, all the validators of this context will be validated.
* Notice its a recursive check meaning sub validation contexts also validates their validators.
* @returns succeed {Promise<boolean>} - Returns a promise that resolves to true if the validator succeeded, this depends on the validators and wether forceSucceed is set.
* @returns succeed {Promise<boolean>} - Returns a promise that resolves to true if the validation succeeded.
*/
async validate(): Promise<void> {
// TODO: clear server messages here?, well maybe only if we know we will get new server messages? Do the server messages hook into the system like another validator?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import type { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
import type { UmbUiCultureInputElement } from '@umbraco-cms/backoffice/localization';
import { umbBindToValidation } from '@umbraco-cms/backoffice/validation';

@customElement('umb-user-workspace-profile-settings')
export class UmbUserWorkspaceProfileSettingsElement extends UmbLitElement {
Expand Down Expand Up @@ -79,6 +80,7 @@ export class UmbUserWorkspaceProfileSettingsElement extends UmbLitElement {
@change="${this.#onEmailChange}"
required
required-message=${this.localize.term('user_emailRequired')}
${umbBindToValidation(this)}
value=${ifDefined(this._user?.email)}></uui-input>
</umb-property-layout>
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { UmbSubmittableWorkspaceContext } from '@umbraco-cms/backoffice/wor
import { UmbSubmittableWorkspaceContextBase } from '@umbraco-cms/backoffice/workspace';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
import { UmbValidationContext } from '@umbraco-cms/backoffice/validation';

type EntityType = UmbUserDetailModel;

Expand Down Expand Up @@ -40,6 +41,8 @@ export class UmbUserWorkspaceContext
constructor(host: UmbControllerHost) {
super(host, UMB_USER_WORKSPACE_ALIAS);

this.addValidationContext(new UmbValidationContext(this));

this.routes.setRoutes([
{
path: 'edit/:id',
Expand Down
Loading