diff --git a/public/locales/en.json b/public/locales/en.json index c1a6c1a7e2..aa8e39d0bc 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -128,7 +128,7 @@ "createSampleOrganization": "Create Sample Organization", "description": "Description", "location": "Location", - "isPublic": "Is Public", + "userRegistrationRequired": "User Registration Required", "visibleInSearch": "Visible In Search", "displayImage": "Display Image", "enterName": "Enter Name", @@ -486,7 +486,7 @@ "description": "Description", "location": "Location", "displayImage": "Display Image", - "isPublic": "Public", + "userRegistrationRequired": "User Registration Required", "isVisibleInSearch": "Visible in Search", "saveChanges": "Save Changes", "enterNameOrganization": "Enter Organization Name", diff --git a/public/locales/fr.json b/public/locales/fr.json index 2adb370627..4b88d8ee24 100644 --- a/public/locales/fr.json +++ b/public/locales/fr.json @@ -127,7 +127,7 @@ "createSampleOrganization": "Créer une organisation d'exemple", "description": "La description", "location": "Emplacement", - "isPublic": "Est publique", + "userRegistrationRequired": "enregistrement requis", "visibleInSearch": "Visible dans la recherche", "displayImage": "Afficher l'image", "enterName": "Entrez le nom", @@ -484,7 +484,7 @@ "description": "La description", "location": "emplacement", "displayImage": "Afficher l'image", - "isPublic": "Public", + "userRegistrationRequired": "enregistrement requis", "isVisibleInSearch": "Visible dans la recherche", "saveChanges": "Sauvegarder les modifications", "enterNameOrganization": "Entrez le nom de l'organisation", diff --git a/public/locales/hi.json b/public/locales/hi.json index b44fc76e59..ca6b731fe4 100644 --- a/public/locales/hi.json +++ b/public/locales/hi.json @@ -127,7 +127,7 @@ "createSampleOrganization": " सैंपल संगठन बनाएं", "description": "विवरण", "location": "स्थान", - "isPublic": "सार्वजनिक है", + "userRegistrationRequired": "उपयोगकर्ता पंजीकरण आवश्यक", "visibleInSearch": "खोज में दृश्यमान", "displayImage": "प्रदर्शन छवि", "enterName": "नाम दर्ज करें", @@ -483,7 +483,7 @@ "description": "विवरण", "location": "जगह", "displayImage": "प्रदर्शन छवि", - "isPublic": "सार्वजनिक", + "userRegistrationRequired": "उपयोगकर्ता पंजीकरण आवश्यक", "isVisibleInSearch": "खोज में दिखाए जा सकते हैं", "saveChanges": "परिवर्तनों को सुरक्षित करें", "cancel": "रद्द करना", diff --git a/public/locales/sp.json b/public/locales/sp.json index 5f10f3c6be..493efcc364 100644 --- a/public/locales/sp.json +++ b/public/locales/sp.json @@ -127,7 +127,7 @@ "createSampleOrganization": "Crear organización de muestra", "description": "Descripción", "location": "Ubicación", - "isPublic": "Es público", + "userRegistrationRequired": "Registro de usuario requerido", "visibleInSearch": "Visible en la búsqueda", "displayImage": "Mostrar imagen", "enterName": "Ingrese su nombre", @@ -483,7 +483,7 @@ "description": "Descripción", "location": "ubicación", "displayImage": "Mostrar imagen", - "isPublic": "Público", + "userRegistrationRequired": "Registro de usuario requerido", "isVisibleInSearch": "Visible en la búsqueda", "saveChanges": "Guardar cambios", "cancel": "Cancelar", diff --git a/public/locales/zh.json b/public/locales/zh.json index 68d43b4248..13be168772 100644 --- a/public/locales/zh.json +++ b/public/locales/zh.json @@ -127,7 +127,7 @@ "createSampleOrganization": "创建示范组织", "description": "描述", "location": "地點", - "isPublic": "是否公開", + "isPubluserRegistrationRequiredic": "需要用户注册", "visibleInSearch": "在搜索中可見", "displayImage": "顯示圖像", "enterName": "输入名字", @@ -483,7 +483,7 @@ "description": "描述", "location": "地點", "displayImage": "顯示圖像", - "isPublic": "公开", + "userRegistrationRequired": "需要用户注册", "isVisibleInSearch": "在搜索中可见", "saveChanges": "保存更改", "cancel": "取消", diff --git a/schema.graphql b/schema.graphql index 0d8c984c9f..df1bca9b29 100644 --- a/schema.graphql +++ b/schema.graphql @@ -545,7 +545,7 @@ type Organization { creator: User! description: String! image: String - isPublic: Boolean! + userRegistrationRequired: Boolean! location: String members: [User] membershipRequests: [MembershipRequest] @@ -566,7 +566,7 @@ type OrganizationInfoNode { creator: User! description: String! image: String - isPublic: Boolean! + userRegistrationRequired: Boolean! name: String! visibleInSearch: Boolean! } @@ -576,7 +576,7 @@ input OrganizationInput { attendees: String description: String! image: String - isPublic: Boolean! + userRegistrationRequired: Boolean! location: String name: String! visibleInSearch: Boolean! @@ -614,7 +614,7 @@ input OrganizationWhereInput { id_not: ID id_not_in: [ID!] id_starts_with: ID - isPublic: Boolean + userRegistrationRequired: Boolean name: String name_contains: String name_in: [String!] @@ -949,7 +949,7 @@ input UpdateEventProjectInput { input UpdateOrganizationInput { description: String - isPublic: Boolean + userRegistrationRequired: Boolean location: String name: String visibleInSearch: Boolean diff --git a/src/GraphQl/Mutations/mutations.ts b/src/GraphQl/Mutations/mutations.ts index c592353055..00c6892a8c 100644 --- a/src/GraphQl/Mutations/mutations.ts +++ b/src/GraphQl/Mutations/mutations.ts @@ -50,7 +50,7 @@ export const UPDATE_ORGANIZATION_MUTATION = gql` $name: String $description: String $location: String - $isPublic: Boolean + $userRegistrationRequired: Boolean $visibleInSearch: Boolean $file: String ) { @@ -59,7 +59,7 @@ export const UPDATE_ORGANIZATION_MUTATION = gql` data: { name: $name description: $description - isPublic: $isPublic + userRegistrationRequired: $userRegistrationRequired visibleInSearch: $visibleInSearch location: $location } @@ -185,7 +185,7 @@ export const CREATE_ORGANIZATION_MUTATION = gql` $location: String! $name: String! $visibleInSearch: Boolean! - $isPublic: Boolean! + $userRegistrationRequired: Boolean! $image: String ) { createOrganization( @@ -194,7 +194,7 @@ export const CREATE_ORGANIZATION_MUTATION = gql` location: $location name: $name visibleInSearch: $visibleInSearch - isPublic: $isPublic + userRegistrationRequired: $userRegistrationRequired } file: $image ) { diff --git a/src/GraphQl/Queries/Queries.ts b/src/GraphQl/Queries/Queries.ts index 43ef608242..3b3631336a 100644 --- a/src/GraphQl/Queries/Queries.ts +++ b/src/GraphQl/Queries/Queries.ts @@ -271,7 +271,7 @@ export const ORGANIZATIONS_LIST = gql` name description location - isPublic + userRegistrationRequired visibleInSearch members { _id @@ -646,7 +646,7 @@ export const USER_ORGANIZATION_CONNECTION = gql` name image description - isPublic + userRegistrationRequired creator { firstName lastName diff --git a/src/components/Advertisements/Advertisements.test.tsx b/src/components/Advertisements/Advertisements.test.tsx index 6113609ebe..bf97628500 100644 --- a/src/components/Advertisements/Advertisements.test.tsx +++ b/src/components/Advertisements/Advertisements.test.tsx @@ -126,7 +126,7 @@ const ORGANIZATIONS_LIST_MOCK = { }, name: 'name', description: 'description', - isPublic: true, + userRegistrationRequired: true, visibleInSearch: true, location: 'location', diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx index 8190e7bd19..63afc4118f 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx @@ -89,7 +89,7 @@ const MOCKS = [ name: 'Test Organization', description: 'Testing this organization', location: 'Gotham, DC', - isPublic: true, + userRegistrationRequired: true, visibleInSearch: true, members: [ { @@ -143,7 +143,7 @@ const MOCKS_WITH_IMAGE = [ name: 'Test Organization', description: 'Testing this organization', location: 'Gotham, DC', - isPublic: true, + userRegistrationRequired: true, visibleInSearch: true, members: [ { diff --git a/src/components/OrgUpdate/OrgUpdate.test.tsx b/src/components/OrgUpdate/OrgUpdate.test.tsx index 79b076c452..6a50cfe899 100644 --- a/src/components/OrgUpdate/OrgUpdate.test.tsx +++ b/src/components/OrgUpdate/OrgUpdate.test.tsx @@ -32,7 +32,7 @@ describe('Testing Organization Update', () => { description: 'This is a updated description', location: 'This is updated location', displayImage: new File(['hello'], 'hello.png', { type: 'image/png' }), - isPublic: false, + userRegistrationRequired: false, isVisible: true, }; @@ -54,21 +54,22 @@ describe('Testing Organization Update', () => { expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Location')).toBeInTheDocument(); expect(screen.getByText('Display Image:')).toBeInTheDocument(); - expect(screen.getByText('Public:')).toBeInTheDocument(); + expect(screen.getByText(/Registration/)).toBeInTheDocument(); expect(screen.getByText('Visible in Search:')).toBeInTheDocument(); // Get the input fields, and btns const name = screen.getByPlaceholderText(/Enter Organization Name/i); const des = screen.getByPlaceholderText(/Description/i); const location = screen.getByPlaceholderText(/Location/i); - const isPublic = screen.getByPlaceholderText(/Public/i); + const userRegistrationRequired = + screen.getByPlaceholderText(/Registration/i); const isVisible = screen.getByPlaceholderText(/Visible/i); // Checking if form fields got updated according to the mock data expect(name).toHaveValue('Palisadoes'); expect(des).toHaveValue('Equitable Access to STEM Education Jobs'); expect(location).toHaveValue('Jamaica'); - expect(isPublic).toBeChecked(); + expect(userRegistrationRequired).toBeChecked(); expect(isVisible).not.toBeChecked(); }); @@ -90,7 +91,8 @@ describe('Testing Organization Update', () => { const des = screen.getByPlaceholderText(/Description/i); const location = screen.getByPlaceholderText(/Location/i); const displayImage = screen.getByPlaceholderText(/Display Image/i); - const isPublic = screen.getByPlaceholderText(/Public/i); + const userRegistrationRequired = + screen.getByPlaceholderText(/Registration/i); const isVisible = screen.getByPlaceholderText(/Visible/i); const saveChangesBtn = screen.getByText(/Save Changes/i); @@ -104,7 +106,7 @@ describe('Testing Organization Update', () => { userEvent.type(des, formData.description); userEvent.type(location, formData.location); userEvent.upload(displayImage, formData.displayImage); - userEvent.click(isPublic); + userEvent.click(userRegistrationRequired); userEvent.click(isVisible); await wait(); @@ -115,7 +117,7 @@ describe('Testing Organization Update', () => { expect(des).toHaveValue(formData.description); expect(location).toHaveValue(formData.location); expect(displayImage).toBeTruthy(); - expect(isPublic).not.toBeChecked(); + expect(userRegistrationRequired).not.toBeChecked(); expect(isVisible).toBeChecked(); }); @@ -151,7 +153,8 @@ describe('Testing Organization Update', () => { const des = screen.getByPlaceholderText(/Description/i); const location = screen.getByPlaceholderText(/Location/i); const displayImage = screen.getByPlaceholderText(/Display Image/i); - const isPublic = screen.getByPlaceholderText(/Public/i); + const userRegistrationRequired = + screen.getByPlaceholderText(/Registration/i); const isVisible = screen.getByPlaceholderText(/Visible/i); const saveChangesBtn = screen.getByText(/Save Changes/i); @@ -165,7 +168,7 @@ describe('Testing Organization Update', () => { userEvent.type(des, formData.description); userEvent.type(location, formData.location); userEvent.upload(displayImage, formData.displayImage); - userEvent.click(isPublic); + userEvent.click(userRegistrationRequired); userEvent.click(isVisible); await wait(); diff --git a/src/components/OrgUpdate/OrgUpdate.tsx b/src/components/OrgUpdate/OrgUpdate.tsx index 16222717d6..ccbb8214b8 100644 --- a/src/components/OrgUpdate/OrgUpdate.tsx +++ b/src/components/OrgUpdate/OrgUpdate.tsx @@ -34,7 +34,8 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element { orgImage: null, }); - const [publicchecked, setPublicChecked] = React.useState(false); + const [userRegistrationRequiredChecked, setuserRegistrationRequiredChecked] = + React.useState(false); const [visiblechecked, setVisibleChecked] = React.useState(false); const [login] = useMutation(UPDATE_ORGANIZATION_MUTATION); @@ -69,7 +70,9 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element { orgDescrip: data.organizations[0].description, location: data.organizations[0].location, }); - setPublicChecked(data.organizations[0].isPublic); + setuserRegistrationRequiredChecked( + data.organizations[0].userRegistrationRequired + ); setVisibleChecked(data.organizations[0].visibleInSearch); } return () => { @@ -85,7 +88,7 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element { name: formState.orgName, description: formState.orgDescrip, location: formState.location, - isPublic: publicchecked, + userRegistrationRequired: userRegistrationRequiredChecked, visibleInSearch: visiblechecked, file: formState.orgImage, }, @@ -165,11 +168,17 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element { /> - {t('isPublic')}: + + {t('userRegistrationRequired')}: + setPublicChecked(!publicchecked)} + placeholder={t('userRegistrationRequired')} + checked={userRegistrationRequiredChecked} + onChange={(): void => + setuserRegistrationRequiredChecked( + !userRegistrationRequiredChecked + ) + } /> diff --git a/src/components/OrgUpdate/OrgUpdateMocks.ts b/src/components/OrgUpdate/OrgUpdateMocks.ts index cd78d37fd0..5cd41cc942 100644 --- a/src/components/OrgUpdate/OrgUpdateMocks.ts +++ b/src/components/OrgUpdate/OrgUpdateMocks.ts @@ -16,7 +16,7 @@ export const MOCKS = [ name: 'Palisadoes', description: 'Equitable Access to STEM Education Jobs', location: 'Jamaica', - isPublic: true, + userRegistrationRequired: true, visibleInSearch: false, creator: { firstName: 'John', @@ -60,7 +60,7 @@ export const MOCKS = [ description: 'This is an updated test organization', location: 'Updated location', image: new File(['hello'], 'hello.png', { type: 'image/png' }), - isPublic: true, + userRegistrationRequired: true, visibleInSearch: false, }, }, @@ -71,7 +71,7 @@ export const MOCKS = [ name: 'Updated Organization', description: 'This is an updated test organization', location: 'Updated location', - isPublic: true, + userRegistrationRequired: true, visibleInSearch: false, }, }, @@ -104,7 +104,7 @@ export const MOCKS_ERROR_UPDATE_ORGLIST = [ name: 'Palisadoes', description: 'Equitable Access to STEM Education Jobs', location: 'Jamaica', - isPublic: true, + userRegistrationRequired: true, visibleInSearch: false, creator: { firstName: 'John', @@ -148,7 +148,7 @@ export const MOCKS_ERROR_UPDATE_ORGLIST = [ description: 'This is an updated test organization', location: 'Updated location', image: new File(['hello'], 'hello.png', { type: 'image/png' }), - isPublic: true, + userRegistrationRequired: true, visibleInSearch: false, }, }, diff --git a/src/components/UserPortal/OrganizationNavbar/OrganizationNavbar.test.tsx b/src/components/UserPortal/OrganizationNavbar/OrganizationNavbar.test.tsx index 6a0fecedfd..15aeed2ce5 100644 --- a/src/components/UserPortal/OrganizationNavbar/OrganizationNavbar.test.tsx +++ b/src/components/UserPortal/OrganizationNavbar/OrganizationNavbar.test.tsx @@ -36,7 +36,7 @@ const MOCK_ORGANIZATION_CONNECTION = { image: '', name: 'anyOrganization1', description: 'desc', - isPublic: true, + userRegistrationRequired: true, creator: { __typename: 'User', firstName: 'John', lastName: 'Doe' }, }, ], diff --git a/src/screens/OrgList/OrgList.test.tsx b/src/screens/OrgList/OrgList.test.tsx index f180640e44..3ab0bb12af 100644 --- a/src/screens/OrgList/OrgList.test.tsx +++ b/src/screens/OrgList/OrgList.test.tsx @@ -187,7 +187,7 @@ describe('Organisations Page testing as SuperAdmin', () => { formData.description ); userEvent.type(screen.getByPlaceholderText(/Location/i), formData.location); - userEvent.click(screen.getByTestId(/isPublic/i)); + userEvent.click(screen.getByTestId(/userRegistrationRequired/i)); userEvent.click(screen.getByTestId(/visibleInSearch/i)); userEvent.upload(screen.getByLabelText(/Display Image/i), formData.image); @@ -200,7 +200,7 @@ describe('Organisations Page testing as SuperAdmin', () => { expect(screen.getByPlaceholderText(/Location/i)).toHaveValue( formData.location ); - expect(screen.getByTestId(/isPublic/i)).not.toBeChecked(); + expect(screen.getByTestId(/userRegistrationRequired/i)).not.toBeChecked(); expect(screen.getByTestId(/visibleInSearch/i)).toBeChecked(); expect(screen.getByLabelText(/Display Image/i)).toBeTruthy(); @@ -247,7 +247,7 @@ describe('Organisations Page testing as SuperAdmin', () => { formData.description ); userEvent.type(screen.getByPlaceholderText(/Location/i), formData.location); - userEvent.click(screen.getByTestId(/isPublic/i)); + userEvent.click(screen.getByTestId(/userRegistrationRequired/i)); userEvent.click(screen.getByTestId(/visibleInSearch/i)); userEvent.upload(screen.getByLabelText(/Display Image/i), formData.image); @@ -260,7 +260,7 @@ describe('Organisations Page testing as SuperAdmin', () => { expect(screen.getByPlaceholderText(/Location/i)).toHaveValue( formData.location ); - expect(screen.getByTestId(/isPublic/i)).not.toBeChecked(); + expect(screen.getByTestId(/userRegistrationRequired/i)).not.toBeChecked(); expect(screen.getByTestId(/visibleInSearch/i)).toBeChecked(); expect(screen.getByLabelText(/Display Image/i)).toBeTruthy(); diff --git a/src/screens/OrgList/OrgList.tsx b/src/screens/OrgList/OrgList.tsx index 554639c12e..d303657082 100644 --- a/src/screens/OrgList/OrgList.tsx +++ b/src/screens/OrgList/OrgList.tsx @@ -62,7 +62,7 @@ function orgList(): JSX.Element { const [formState, setFormState] = useState({ name: '', descrip: '', - ispublic: true, + userRegistrationRequired: true, visible: false, location: '', image: '', @@ -120,7 +120,7 @@ function orgList(): JSX.Element { setFormState({ name: '', descrip: '', - ispublic: true, + userRegistrationRequired: true, visible: false, location: '', image: '', @@ -169,7 +169,7 @@ function orgList(): JSX.Element { descrip: _descrip, location: _location, visible, - ispublic, + userRegistrationRequired, image, } = formState; @@ -184,7 +184,7 @@ function orgList(): JSX.Element { description: descrip, location: location, visibleInSearch: visible, - isPublic: ispublic, + userRegistrationRequired: userRegistrationRequired, image: image, }, }); @@ -197,7 +197,7 @@ function orgList(): JSX.Element { setFormState({ name: '', descrip: '', - ispublic: true, + userRegistrationRequired: true, visible: false, location: '', image: '', @@ -562,16 +562,19 @@ function orgList(): JSX.Element { - {t('isPublic')} + + {t('userRegistrationRequired')} + setFormState({ ...formState, - ispublic: !formState.ispublic, + userRegistrationRequired: + !formState.userRegistrationRequired, }) } /> diff --git a/src/screens/OrgList/OrgListMocks.ts b/src/screens/OrgList/OrgListMocks.ts index 833535f4aa..3d86e27747 100644 --- a/src/screens/OrgList/OrgListMocks.ts +++ b/src/screens/OrgList/OrgListMocks.ts @@ -128,7 +128,7 @@ const MOCKS = [ location: 'Delhi, India', name: 'Dummy Organization', visibleInSearch: true, - isPublic: false, + userRegistrationRequired: false, image: '', }, }, diff --git a/src/screens/OrganizationDashboard/OrganizationDashboardMocks.ts b/src/screens/OrganizationDashboard/OrganizationDashboardMocks.ts index dc1f158709..8834066114 100644 --- a/src/screens/OrganizationDashboard/OrganizationDashboardMocks.ts +++ b/src/screens/OrganizationDashboard/OrganizationDashboardMocks.ts @@ -19,7 +19,7 @@ export const MOCKS = [ name: 'Dummy Organization', description: 'This is a Dummy Organization', location: 'New Delhi', - isPublic: true, + userRegistrationRequired: true, visibleInSearch: false, creator: { firstName: '', @@ -199,7 +199,7 @@ export const EMPTY_MOCKS = [ name: 'Dummy Organization', description: 'This is a Dummy Organization', location: 'New Delhi', - isPublic: true, + userRegistrationRequired: true, visibleInSearch: false, creator: { firstName: 'John', diff --git a/src/screens/UserPortal/Donate/Donate.test.tsx b/src/screens/UserPortal/Donate/Donate.test.tsx index 3abb433c51..8d8673a502 100644 --- a/src/screens/UserPortal/Donate/Donate.test.tsx +++ b/src/screens/UserPortal/Donate/Donate.test.tsx @@ -55,7 +55,7 @@ const MOCKS = [ image: '', name: 'anyOrganization2', description: 'desc', - isPublic: true, + userRegistrationRequired: true, creator: { __typename: 'User', firstName: 'John', lastName: 'Doe' }, }, ], diff --git a/src/screens/UserPortal/Organizations/Organizations.test.tsx b/src/screens/UserPortal/Organizations/Organizations.test.tsx index f206ccab8f..4590af213c 100644 --- a/src/screens/UserPortal/Organizations/Organizations.test.tsx +++ b/src/screens/UserPortal/Organizations/Organizations.test.tsx @@ -58,7 +58,7 @@ const MOCKS = [ image: '', name: 'anyOrganization1', description: 'desc', - isPublic: true, + userRegistrationRequired: true, creator: { __typename: 'User', firstName: 'John', lastName: 'Doe' }, }, { @@ -67,7 +67,7 @@ const MOCKS = [ image: '', name: 'anyOrganization2', description: 'desc', - isPublic: true, + userRegistrationRequired: true, creator: { __typename: 'User', firstName: 'John', lastName: 'Doe' }, }, ], @@ -115,7 +115,7 @@ const MOCKS = [ image: '', name: 'anyOrganization2', description: 'desc', - isPublic: true, + userRegistrationRequired: true, creator: { __typename: 'User', firstName: 'John', lastName: 'Doe' }, }, ], diff --git a/src/utils/interfaces.ts b/src/utils/interfaces.ts index e90711028f..c23298f547 100644 --- a/src/utils/interfaces.ts +++ b/src/utils/interfaces.ts @@ -46,7 +46,7 @@ export interface InterfaceQueryOrganizationsListObject { name: string; description: string; location: string; - isPublic: boolean; + userRegistrationRequired: boolean; visibleInSearch: boolean; members: { _id: string;