on master help sign in
sponsorship: L1 can sponsor points on L2

This closes #898 by allowing L1 points to sponsor points on L2. It does so by skipping the L2 roller quota check for `adopt`, `reject`, and `detach` actions.

commitd58076f3c747ecf90f65cf80c0cb6e817d6b6c6a authortomholford <tomholford@users.noreply.github.com> dateMon 31 Jan 2022, 13:13 (5 years ago) parentfeb9e8e
3 files changed+13−9
src/lib/useRoller.ts+6−2 src/views/Ops/Requests.tsx+4−4 src/views/Ops/Residents.tsx+3−3
src/lib/useRoller.ts+6−2
@@ -815,8 +815,12 @@ export default function useRoller() {
815815 );
816816
817817 const changeSponsorship = useCallback(
818− async (sponsee: Ship, type: 'adopt' | 'detach' | 'reject') => {
819− if (quotaReached()) {
818+ async (
819+ sponsee: Ship,
820+ type: 'adopt' | 'detach' | 'reject',
821+ skipQuotaCheck = false
822+ ) => {
823+ if (!skipQuotaCheck && quotaReached()) {
820824 return;
821825 }
822826
src/views/Ops/Requests.tsx+4−4
@@ -35,21 +35,21 @@ export const Requests = () => {
3535 const handleAcceptClick = useCallback(
3636 async (ship: Ship) => {
3737 setLoading(true);
38− await changeSponsorship(ship, 'adopt');
38+ await changeSponsorship(ship, 'adopt', point.isL1);
3939 await fetchRequests();
4040 setLoading(false);
4141 },
42− [changeSponsorship, fetchRequests, setLoading]
42+ [changeSponsorship, fetchRequests, point.isL1, setLoading]
4343 );
4444
4545 const handleRejectClick = useCallback(
4646 async (ship: Ship) => {
4747 setLoading(true);
48− await changeSponsorship(ship, 'reject');
48+ await changeSponsorship(ship, 'reject', point.isL1);
4949 await fetchRequests();
5050 setLoading(false);
5151 },
52− [changeSponsorship, fetchRequests, setLoading]
52+ [changeSponsorship, fetchRequests, point.isL1, setLoading]
5353 );
5454
5555 useEffect(() => {
src/views/Ops/Residents.tsx+3−3
@@ -34,13 +34,13 @@ export const Residents = () => {
3434 }, [api, point, setLoading]);
3535
3636 const handleKick = useCallback(
37− async (point: Ship) => {
37+ async (ship: Ship) => {
3838 setLoading(true);
39− await changeSponsorship(point, 'detach');
39+ await changeSponsorship(ship, 'detach', point.isL1);
4040 await fetchResidents();
4141 setLoading(false);
4242 },
43− [fetchResidents, changeSponsorship, setLoading]
43+ [setLoading, changeSponsorship, point.isL1, fetchResidents]
4444 );
4545
4646 useEffect(() => {