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

patrons: add a role async validator #567

Merged
merged 1 commit into from
Apr 29, 2021
Merged

Conversation

jma
Copy link
Contributor

@jma jma commented Apr 14, 2021

  • Removes useless console log messages.
  • Adds a role patron editor validator to avoid multiple professional
    accounts

For reviewer

Only the last commit.

Why are you opening this PR?

Dependencies

How to test?

  • What command should I have to run to test your PR?
  • What should I test through the UI?

Code review check list

  • Commit message template compliance.
  • Commit message without typos.
  • File names.
  • Functions names.
  • Functions docstrings.
  • Unnecessary commited files?
  • Cypress tests successful?

@jma jma changed the title Maj patron role validator patrons: add a role async validator Apr 14, 2021
@jma jma marked this pull request as ready for review April 14, 2021 17:57
*
* @param field - formly field config.
*/
_getRoleValidator(field: FormlyFieldConfig) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add term private

_getRoleValidator(field: FormlyFieldConfig) {
return {
expression: (control: FormControl) => {
console.log('validate');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

@jma jma force-pushed the maj-patron-role-validator branch 3 times, most recently from fc3dc2e to 74454d8 Compare April 15, 2021 09:52
*
* @param field - formly field config.
*/
private _getRoleValidator(field: FormlyFieldConfig) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output typing: Observable<Boolean> ?

Comment on lines +137 to +142
if (ptrn.organisation.pid !== currentOrgPid) {
if (ptrn.roles.some(role => ['librarian', 'system_librarian'].some(r => r === role))) {
return true;
}
}
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merged ?

return (ptrn.organisation.pid !== currentOrgPid) && (ptrn.roles.some(role => ['librarian', 'system_librarian'].some(r => r === role)));

@jma jma added this to the v1.2.0 milestone Apr 22, 2021
@jma jma force-pushed the maj-patron-role-validator branch from 74454d8 to 85de364 Compare April 22, 2021 16:07
@jma jma force-pushed the maj-patron-role-validator branch 2 times, most recently from a4c1d56 to 0c226e6 Compare April 29, 2021 12:29
* Removes useless console log messages.
* Adds a role patron editor validator to avoid multiple professional
  accounts.
* Fixes spelling: constributionSources -> contributionSources.

Co-Authored-by: Johnny Mariéthoz <johnny.mariethoz@rero.ch>
@jma jma changed the base branch from US-2034-multiple-patron to dev April 29, 2021 15:11
@jma jma force-pushed the maj-patron-role-validator branch from 0c226e6 to 34ca3ff Compare April 29, 2021 15:13
@jma jma merged commit 8e85d4c into rero:dev Apr 29, 2021
@jma jma deleted the maj-patron-role-validator branch January 13, 2022 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants