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

Fix/proxy payment #745

Merged
merged 5 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions db/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ type InvoiceRequest struct {
Commitment_fee uint `json:"commitment_fee,omitempty"`
Bounty_expires string `json:"bounty_expires,omitempty"`
Websocket_token string `json:"websocket_token,omitempty"`
Route_hint string `json:"route_hint,omitempty"`
}

type Invoice struct {
Expand All @@ -262,6 +263,7 @@ type InvoiceStoreData struct {
Assigned_hours uint `json:"assigned_hours,omitempty"`
Commitment_fee uint `json:"commitment_fee,omitempty"`
Bounty_expires string `json:"bounty_expires,omitempty"`
Route_hint string `json:"route_hint,omitempty"`
}

type InvoiceStatus struct {
Expand Down Expand Up @@ -508,6 +510,7 @@ type PaymentHistoryData struct {
type BountyPayRequest struct {
ReceiverPubKey string `json:"receiver_pubkey"`
Websocket_token string `json:"websocket_token,omitempty"`
RouteHint string `json:"route_hint,omitempty"`
}

func (Person) TableName() string {
Expand Down
16 changes: 8 additions & 8 deletions frontend/app/src/people/main/FocusView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ const B = styled.div<BProps>`
overflow-y: auto;
box-sizing: border-box;
${EnvWithScrollBar({
thumbColor: '#5a606c',
trackBackgroundColor: 'rgba(0,0,0,0)'
})}
thumbColor: '#5a606c',
trackBackgroundColor: 'rgba(0,0,0,0)'
})}
`;
function FocusedView(props: FocusViewProps) {
const {
Expand Down Expand Up @@ -109,9 +109,9 @@ function FocusedView(props: FocusViewProps) {

const userOrganizations = main.organizations.length
? main.organizations.map((org: Organization) => ({
label: toCapitalize(org.name),
value: org.uuid
}))
label: toCapitalize(org.name),
value: org.uuid
}))
: [];

function isNotHttps(url: string | undefined) {
Expand Down Expand Up @@ -420,8 +420,8 @@ function FocusedView(props: FocusViewProps) {
extraHTML={
ui.meInfo.verification_signature
? {
twitter: `<span>Post this to your twitter account to verify:</span><br/><strong>Sphinx Verification: ${ui.meInfo.verification_signature}</strong>`
}
twitter: `<span>Post this to your twitter account to verify:</span><br/><strong>Sphinx Verification: ${ui.meInfo.verification_signature}</strong>`
}
: {}
}
/>
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/people/utils/AssignBounty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default function AssignBounty(props: ConnectCardProps) {
memo: '',
owner_pubkey: person?.owner_pubkey ?? '',
user_pubkey: ui.meInfo?.owner_pubkey ?? '',
route_hint: person?.route_hint,
created: created ? created.toString() : '',
type: 'ASSIGN',
assigned_hours: bountyHours,
Expand Down
52 changes: 26 additions & 26 deletions frontend/app/src/people/widgetViews/OrganizationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -487,32 +487,32 @@ const OrganizationDetails = (props: { close: () => void; org: Organization | und
<Actions>
{(isOrganizationAdmin ||
userHasRole(main.bountyRoles, userRoles, 'ADD ROLES')) && (
<MaterialIcon
onClick={() => handleSettingsClick(user)}
icon={'settings'}
style={{
fontSize: 20,
marginLeft: 10,
cursor: 'pointer',
color: 'green'
}}
/>
)}
<MaterialIcon
onClick={() => handleSettingsClick(user)}
icon={'settings'}
style={{
fontSize: 20,
marginLeft: 10,
cursor: 'pointer',
color: 'green'
}}
/>
)}
{(isOrganizationAdmin ||
userHasRole(main.bountyRoles, userRoles, 'DELETE USER')) && (
<MaterialIcon
onClick={() => {
deleteOrganizationUser(user);
}}
icon={'delete'}
style={{
fontSize: 20,
marginLeft: 10,
cursor: 'pointer',
color: 'red'
}}
/>
)}
<MaterialIcon
onClick={() => {
deleteOrganizationUser(user);
}}
icon={'delete'}
style={{
fontSize: 20,
marginLeft: 10,
cursor: 'pointer',
color: 'red'
}}
/>
)}
</Actions>
</Td>
</TableRow>
Expand Down Expand Up @@ -586,8 +586,8 @@ const OrganizationDetails = (props: { close: () => void; org: Organization | und
style={
item.name === 'github_description' && !values.ticket_url
? {
display: 'none'
}
display: 'none'
}
: undefined
}
/>
Expand Down
5 changes: 2 additions & 3 deletions frontend/app/src/people/widgetViews/OrganizationView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const Container = styled.div`

const OrganizationText = styled.p`
font-size: 1rem;
text-transform: capitalize;
font-weight: bold;
margin-top: 15px;
`;
Expand Down Expand Up @@ -276,8 +275,8 @@ const Organizations = (props: { person: Person }) => {
style={
item.name === 'github_description' && !values.ticket_url
? {
display: 'none'
}
display: 'none'
}
: undefined
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ function MobileView(props: CodingBountiesProps) {
memo: '',
owner_pubkey: person.owner_pubkey,
user_pubkey: assignee.owner_pubkey,
route_hint: assignee.route_hint,
created: created ? created?.toString() : '',
type: 'KEYSEND'
});
Expand All @@ -177,7 +178,8 @@ function MobileView(props: CodingBountiesProps) {
const body = {
id: id || 0,
websocket_token: ui.meInfo?.websocketToken || '',
receiver_pubkey: assignee.owner_pubkey
receiver_pubkey: assignee.owner_pubkey,
route_hint: assignee.route_hint
};

await main.makeBountyPayment(body);
Expand Down Expand Up @@ -256,8 +258,8 @@ function MobileView(props: CodingBountiesProps) {
return (
<div>
{{ ...person }?.owner_alias &&
ui.meInfo?.owner_alias &&
{ ...person }?.owner_alias === ui.meInfo?.owner_alias ? (
ui.meInfo?.owner_alias &&
{ ...person }?.owner_alias === ui.meInfo?.owner_alias ? (
/*
* creator view
*/
Expand Down
5 changes: 4 additions & 1 deletion frontend/app/src/store/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,7 @@ export class MainStore {
assigned_hours?: number;
commitment_fee?: number;
bounty_expires?: string;
route_hint?: string;
}): Promise<LnInvoice> {
try {
const data = await api.post(
Expand All @@ -1564,7 +1565,8 @@ export class MainStore {
assigned_hours: body.assigned_hours,
commitment_fee: body.commitment_fee,
bounty_expires: body.bounty_expires,
websocket_token: uiStore.meInfo?.websocketToken
websocket_token: uiStore.meInfo?.websocketToken,
route_hint: body.route_hint
},
{
'Content-Type': 'application/json'
Expand Down Expand Up @@ -1880,6 +1882,7 @@ export class MainStore {
id: number;
receiver_pubkey: string;
websocket_token: string;
route_hint: string;
}): Promise<any> {
try {
if (!uiStore.meInfo) return null;
Expand Down
Loading
Loading