Skip to content

Commit

Permalink
Merge pull request stakwork#619 from aliraza556/Private-Bounties
Browse files Browse the repository at this point in the history
Fixed[Bug]: New `Private` Bounties - On Accept Displays Last Public Bounty
  • Loading branch information
elraphty authored Nov 7, 2024
2 parents e70520c + 6f777ca commit 179f26d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/people/widgetViews/postBounty/PostModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import { useStores } from '../../../store';
import FocusedView from '../../main/FocusView';
import { Widget } from '../../main/types';
import { widgetConfigs } from '../../utils/Constants';
import { PersonBounty } from '../../../store/interface';

const color = colors['light'];

export interface PostModalProps {
isOpen: boolean;
widget: Widget;
Expand All @@ -18,6 +20,7 @@ export interface PostModalProps {
onGoBack?: () => void;
phase_uuid?: string;
}

export const PostModal: FC<PostModalProps> = observer(
({ isOpen, onClose, widget, onGoBack, onSucces, phase_uuid }: any) => {
const { main, ui } = useStores();
Expand Down Expand Up @@ -48,13 +51,19 @@ export const PostModal: FC<PostModalProps> = observer(
}, [main]);

const ReCallBounties = async () => {
/*
TODO : after getting the better way to reload the bounty, this code will be removed.
*/
const number = await getBountyData();
const createdBounties = await main.getPersonCreatedBounties(
{ page: 1, resetPage: true },
person?.uuid
);

const [mostRecentBounty] = createdBounties.sort(
(a: PersonBounty, b: PersonBounty) =>
new Date(b.body?.created).getTime() - new Date(a.body?.created).getTime()
);

if (number) {
history.push(`/bounty/${number}`);
const bountyId = mostRecentBounty?.body?.id || (await getBountyData());
if (bountyId) {
history.push(`/bounty/${bountyId}`);
}
};

Expand Down Expand Up @@ -90,7 +99,6 @@ export const PostModal: FC<PostModalProps> = observer(
}
return (
<>
{' '}
{isOpen && (
<Modal
visible={isOpen}
Expand Down

0 comments on commit 179f26d

Please sign in to comment.