Skip to content

Commit

Permalink
Merge pull request #1027 from Shoaibdev7/fix/owner-only-bounty-actions
Browse files Browse the repository at this point in the history
Restrict Bounty Actions to Owners Only
  • Loading branch information
humansinstitute authored Feb 7, 2025
2 parents 133e28b + 3249175 commit 1c43868
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
52 changes: 29 additions & 23 deletions src/people/widgetViews/summaries/wantedSummaries/CodingBounty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function MobileView(props: CodingBountiesProps) {
assigneeHandlerOpen,
setCreatorStep,
awards,
owner_id,
setExtrasPropertyAndSaveMultiple,
handleAssigneeDetails,
peopleList,
Expand Down Expand Up @@ -493,6 +494,8 @@ function MobileView(props: CodingBountiesProps) {

const isAssigner = person?.owner_pubkey === uiStore._meInfo?.owner_pubkey;

const hasOwnership = owner_id === uiStore._meInfo?.owner_pubkey;

const handleStatusUpdate = async (proofId: string, status: BountyReviewStatus) => {
try {
console.log(proofId, status);
Expand Down Expand Up @@ -744,7 +747,7 @@ function MobileView(props: CodingBountiesProps) {
hasAccess &&
userAssigned && (
<>
{!bountyCompleted && (
{hasOwnership && !bountyCompleted && (
<Button
disabled={paymentLoading || payBountyDisable || !created}
iconSize={14}
Expand All @@ -763,28 +766,31 @@ function MobileView(props: CodingBountiesProps) {
/>
)}

<IconButton
width={'100%'}
height={48}
disabled={
paymentLoading || payBountyDisable || pendingPaymentLoading || bountyPending
}
style={{
bottom: '10px'
}}
text={'Pay Bounty'}
loading={saving === 'paid' || updatingPayment}
textStyle={{
display: 'flex',
justifyContent: 'center',
fontFamily: 'Barlow',
fontSize: '15px',
marginLeft: '30px'
}}
hovercolor={color.button_secondary.hover}
shadowcolor={color.button_secondary.shadow}
onClick={confirmPaymentHandler}
/>
{hasOwnership && (
<IconButton
width={'100%'}
height={48}
disabled={
paymentLoading || payBountyDisable || pendingPaymentLoading || bountyPending
}
style={{
bottom: '10px'
}}
text={'Pay Bounty'}
loading={saving === 'paid' || updatingPayment}
textStyle={{
display: 'flex',
justifyContent: 'center',
fontFamily: 'Barlow',
fontSize: '15px',
marginLeft: '30px'
}}
hovercolor={color.button_secondary.hover}
shadowcolor={color.button_secondary.shadow}
onClick={confirmPaymentHandler}
/>
)}

{isOpenProofModal && (
<CodingBountyProofModal
closeModal={() => setIsOpenProofModal(false)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default function MobileView(props: CodingViewProps) {
)}
<div style={{ padding: 20, overflow: 'auto', height: 'calc(100% - 60px)' }}>
<Pad>
{!bountyPaid && hasAccess && (
{!bountyPaid && hasAccess && isAssigner && (
<div
style={{
display: 'flex',
Expand Down Expand Up @@ -292,7 +292,7 @@ export default function MobileView(props: CodingViewProps) {
marginLeft: '12px'
}}
/>
{hasAccess && !bountyPaid && !bountyPending && (
{hasAccess && !bountyPaid && !bountyPending && isAssigner && (
<div
data-testid="edit-btn"
className="AssigneeCloseButtonContainer"
Expand Down

0 comments on commit 1c43868

Please sign in to comment.