-
Notifications
You must be signed in to change notification settings - Fork 0
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
Admin ability to soft delete and update phone of a member #719
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
aaf997a
Add admin ability to soft delete members
DeeTheDev bc858b8
Sync shared files with admin
DeeTheDev ca88556
Admin ability to update member phone
DeeTheDev 24c96ae
Fix phone param and helperText
DeeTheDev e357183
Content update and return meaningful phone validation error message
DeeTheDev 99d0e92
Truncate long names inside button and misc
DeeTheDev 0e86869
Refactor delete modal
rgalanakis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react"; | ||
|
||
/** | ||
* Just a `React.useEffect(() => cb, [])` that is more declarative than | ||
* doing it in line and disabling eslint. | ||
* @param {function} cb | ||
*/ | ||
export default function useUnmountEffect(cb) { | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
React.useEffect(() => cb, []); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import has from "lodash/has"; | ||
|
||
/** | ||
* Call ref(v) or ref.current = v;. | ||
*/ | ||
export default function setRef(ref, value) { | ||
if (!ref) { | ||
return; | ||
} | ||
if (has(ref, "current")) { | ||
ref.current = value; | ||
return; | ||
} | ||
ref(value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,11 +138,22 @@ def make_item(i) | |
it "updates the member" do | ||
member = Suma::Fixtures.member.create | ||
|
||
post "/v1/members/#{member.id}", name: "b 2", email: "[email protected]" | ||
post "/v1/members/#{member.id}", name: "b 2", email: "[email protected]", phone: "12223334444" | ||
|
||
expect(last_response).to have_status(200) | ||
expect(last_response).to have_json_body. | ||
that_includes(id: member.id, name: "b 2", email: "[email protected]") | ||
that_includes(id: member.id, name: "b 2", email: "[email protected]", phone: "12223334444") | ||
end | ||
|
||
it "400s if a phone number is taken, with instructions message for admins" do | ||
member = Suma::Fixtures.member.create | ||
member_taken = Suma::Fixtures.member.create(phone: "15553335555") | ||
|
||
post "/v1/members/#{member.id}", phone: member_taken.phone | ||
|
||
expect(last_response).to have_status(400) | ||
message = /duplicate a member, make sure that you soft-delete their account first/ | ||
expect(last_response).to have_json_body.that_includes(error: include(message:)) | ||
end | ||
|
||
it "replaces roles if given" do | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if it's taken? We get a nice error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly I want to make sure we explain that the member with the number already, would need to be deleted first.