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

fixed relay user save profile error #729

Merged
merged 1 commit into from
Sep 22, 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
21 changes: 13 additions & 8 deletions frontend/app/src/people/main/FocusView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,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 @@ -103,9 +103,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 @@ -206,6 +206,7 @@ function FocusedView(props: FocusViewProps) {
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
async function submitForm(body: any, shouldCloseModal: boolean = true) {
let newBody = cloneDeep(body);

if (config && config.name === 'about') {
const res = await main.saveProfile(newBody);
if (shouldCloseModal) {
Expand All @@ -226,9 +227,11 @@ function FocusedView(props: FocusViewProps) {
if (!newBody.description) {
addToast();
}

const info = ui.meInfo as any;
if (!info) return console.log('no meInfo');
setLoading(true);

try {
if (typeof newBody?.assignee !== 'string' || !newBody?.assignee) {
newBody.assignee = newBody.assignee?.owner_pubkey ?? 'emptyid';
Expand All @@ -250,7 +253,9 @@ function FocusedView(props: FocusViewProps) {
} catch (e) {
console.log('e', e);
}

if (props?.onSuccess) props.onSuccess();

setLoading(false);
if (ui?.meInfo?.hasOwnProperty('url') && !isNotHttps(ui?.meInfo?.url) && props?.ReCallBounties)
props?.ReCallBounties();
Expand Down Expand Up @@ -380,8 +385,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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { formConfig } from './config';

export const EditUserDesktopView = observer(() => {
const { canEdit, closeHandler, person, modals } = useUserEdit();

return (
<Modal
visible={modals.userEditModal}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function WantedSummary(props: WantedSummaryProps) {
type: type,
created: created
};

formSubmit && formSubmit(newValue);
},
[
Expand Down
6 changes: 4 additions & 2 deletions frontend/app/src/store/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1256,12 +1256,14 @@ export class MainStore {
// first time profile makers will need this on first login
if (!body.id) {
const j = await r.json();
if (j.response.id) {
if (j.response && j.response.id) {
body.id = j.response.id;
}
}

await this.getSelf(body);
const updateSelf = { ...info, ...body };
await this.getSelf(updateSelf);

uiStore.setToasts([
{
id: '1',
Expand Down
Loading