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

Remove ID Numbers from Membership, Request, and Admin Routes #1533

Merged
merged 33 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
70299d8
save progress
bennettforkner Sep 19, 2022
2fac721
Merge branch 'develop' into remove_membership_account_by_email_logic
bennettforkner Sep 22, 2022
5a4ab52
revert changes on membership card
bennettforkner Sep 22, 2022
2a22639
replace id numbers in memberships
bennettforkner Sep 23, 2022
e76ccd4
updating routes with RESTful structure
bennettforkner Sep 26, 2022
078472b
saving progress
bennettforkner Sep 29, 2022
fe6a1d6
Update MembershipRequest components & services
bennettforkner Oct 6, 2022
d6df2bb
undo change to api url
bennettforkner Oct 14, 2022
7b7b2d4
Update Upload type field naming (also done in DB)
bennettforkner Oct 14, 2022
754e0ca
Remove ID Numbers from Admin
bennettforkner Oct 14, 2022
db2c67b
Remove Email Account Endpoint
bennettforkner Oct 14, 2022
9105b8b
Move requests status filter into the API
bennettforkner Oct 14, 2022
0b83cab
Correct Spelling
bennettforkner Oct 14, 2022
d4cf066
Simplifying set lambda
bennettforkner Oct 14, 2022
2792111
Merge branch 'develop' into remove_membership_account_by_email_logic
bennettforkner Oct 14, 2022
7f4c6c2
Fixing misc broken functionality
bennettforkner Oct 18, 2022
45e634a
Merge branch 'remove_membership_account_by_email_logic' of https://gi…
bennettforkner Oct 18, 2022
04caa3c
Update src/views/Admin/components/AdminList/index.js
bennettforkner Oct 26, 2022
508cc9a
Changes requested by @EJPlatzer in #1533
bennettforkner Nov 2, 2022
41cc1b2
Merge branch 'remove_membership_account_by_email_logic' of https://gi…
bennettforkner Nov 2, 2022
bc32f86
revert changes to api URL
bennettforkner Nov 2, 2022
b090e72
Merge branch 'develop' into remove_membership_account_by_email_logic
bennettforkner Nov 2, 2022
eabcdcb
unrelated - gitignore certs folder for SSL
bennettforkner Nov 14, 2022
d25e437
Use temporary variable for username formatting
bennettforkner Nov 14, 2022
b47cee4
rename username variable
bennettforkner Nov 14, 2022
328559e
remove certs from .gitignore
bennettforkner Nov 14, 2022
96c8d8d
Merge branch 'develop' into remove_membership_account_by_email_logic
bennettforkner Nov 16, 2022
1e91f74
Factor out stripDomain logic to function
bennettforkner Nov 17, 2022
428ea9c
Merge branch 'remove_membership_account_by_email_logic' of https://gi…
bennettforkner Nov 17, 2022
8408204
move stripDomain to utils service
bennettforkner Nov 17, 2022
673ca57
fix accidental nesting
bennettforkner Nov 17, 2022
6255a9f
Fix non-default import
bennettforkner Nov 17, 2022
0662082
Merge branch 'develop' into remove_membership_account_by_email_logic
bennettforkner Nov 17, 2022
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
21 changes: 20 additions & 1 deletion src/services/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,24 @@ export const searchParamSerializerFactory = <
}, initialSearchParams);
};

return { serializeSearchParams, deserializeSearchParams };
/**
* Removes the specified domain name from an email.
*
* If the domain is not specified, it defaults to '@gordon.edu'
*
* @param input the string from which to remove the domain
* @param domain the domain to remove, default '@gordon.edu'
* @returns the value of input with the domain stripped off the end
*/
const stripDomain = (input: string, domain: string = '@gordon.edu') => {
const domainIndex = input.toLowerCase().lastIndexOf(domain);

// if domain was not found, return entire input
if (domainIndex === -1) return input;

// return input until domain
return input.substring(0, domainIndex);
};

return { serializeSearchParams, deserializeSearchParams, stripDomain };
bennettforkner marked this conversation as resolved.
Show resolved Hide resolved
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import GordonDialogBox from 'components/GordonDialogBox';
import { useParams } from 'react-router';
import involvementService from 'services/activity';
import membershipService from 'services/membership';
import utils from 'services/utils';
bennettforkner marked this conversation as resolved.
Show resolved Hide resolved
import { gordonColors } from 'theme';
import RequestsReceived from './components/RequestsReceived';

Expand All @@ -27,16 +28,6 @@ const headerStyle = {
padding: '10px',
};

const stripDomain = (input, domain = '@gordon.edu') => {
const domainIndex = input.toLowerCase().lastIndexOf(domain);

// if domain was not found, return entire input
if (domainIndex === -1) return input;

// return input until domain
return input.substring(0, domainIndex);
};

const AdminCard = ({ createSnackbar, isSiteAdmin, involvementDescription, onAddMember }) => {
const [isRosterClosed, setIsRosterClosed] = useState(false);
const [isDialogOpen, setIsDialogOpen] = useState(false);
Expand All @@ -62,7 +53,7 @@ const AdminCard = ({ createSnackbar, isSiteAdmin, involvementDescription, onAddM
};

const handleAddMember = async () => {
let formattedUsername = stripDomain(username.toLowerCase());
let formattedUsername = utils.stripDomain(username.toLowerCase());

try {
let data = {
Expand Down