Skip to content

Commit

Permalink
Merge pull request #1025 from ORCID/add-null-check-to-url-validation
Browse files Browse the repository at this point in the history
Add null check to url validation
  • Loading branch information
bobcaprice authored Aug 4, 2023
2 parents 397ef0b + f20ca1c commit b8b988a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions gateway/cypress/integration/retention/ui-homepage-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import credentials from '../../fixtures/credentials.json';
const { email, name } = data.homepageTestMembers.consortiumMember;

describe('Test editing member details', () => {
it('Editing Almonds forest member dtails', function () {
it('Editing Almonds Forest member details', function () {
const date = Date.now();
cy.programmaticSignin(email, credentials.password);
cy.visit('/');
Expand Down Expand Up @@ -61,11 +61,12 @@ describe('Test editing member details', () => {
cy.get('app-member-info-landing').contains('Street ' + date + ", City " + date + ", " + date);
cy.get('app-member-info-landing').contains(`YES - ORCID can use trademarked assets`);
cy.visit('/edit');
// wait for data to load
cy.intercept(`/services/memberservice/api/members/${data.homepageTestMembers.consortiumMember.salesforceId}/member-contacts`).as('details');
cy.wait('@details');
cy.get('[name="trademarkLicense"][value="No"]').click();
cy.get('[name="website"]').clear()
cy.get('[type="submit"]').click();
cy.get('app-member-info-landing').contains(`NO - ORCID cannot use this organization's trademarked name and logos`);

});
});
2 changes: 1 addition & 1 deletion gateway/cypress/integration/retention/ui-homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Test homepage', () => {
cy.get('.side-bar').contains("Public details")
cy.get('.side-bar').contains("Website")
cy.get('.side-bar').contains("Email")
cy.get('.side-bar').contains("https://")
cy.get('.side-bar').contains("No website added")
cy.get('.side-bar').contains("@orcid.org")
cy.get('.main-section').contains("Consortium/Parent organization: Mambo No 5")
cy.get('.main-section').contains("Membership: Active")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class MemberInfoEditComponent implements OnInit, OnDestroy {
}

validateUrl() {
if (!/(http(s?)):\/\//i.test(this.memberData.website)) {
if (this.memberData.website && !/(http(s?)):\/\//i.test(this.memberData.website)) {
this.memberData.website = 'http://' + this.memberData.website;
}
}
Expand Down Expand Up @@ -184,6 +184,7 @@ export class MemberInfoEditComponent implements OnInit, OnDestroy {
this.invalidForm = false;
this.isSaving = true;
const details: ISFMemberUpdate = this.createDetailsFromForm();

this.memberService.updateMemberDetails(details, this.memberData.id).subscribe(
res => {
this.memberService.memberData.next({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class MemberInfoLandingComponent implements OnInit, OnDestroy {
}

validateUrl() {
if (!/(http(s?)):\/\//i.test(this.memberData.website)) {
if (this.memberData.website && !/(http(s?)):\/\//i.test(this.memberData.website)) {
this.memberData.website = 'http://' + this.memberData.website;
}
}
Expand Down Expand Up @@ -71,7 +71,6 @@ export class MemberInfoLandingComponent implements OnInit, OnDestroy {
}

stopManagingMember() {
// empty string if it's not working
this.memberService.setManagedMember(null);
this.memberService.fetchMemberData(this.account.salesforceId);
}
Expand Down

0 comments on commit b8b988a

Please sign in to comment.