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

Add sponsorship information in post editor #531

Merged
merged 5 commits into from
Dec 1, 2023

Conversation

itexpert120
Copy link
Contributor

@itexpert120 itexpert120 commented Nov 29, 2023

Resolved #469

The cause of this issue was due to the props not being saved with post. The props being passed to the editor didn't exist. So I wrote some regex to extract those props from the description and used them.
For future posts, I recommend saving these props when creating the post.

2023-11-29.06-15-44.mp4

Copy link
Collaborator

@ailisp ailisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think overall looks great! The only thing I would add is only try to clean up and parse for solution type post

@itexpert120
Copy link
Contributor Author

I think overall looks great! The only thing I would add is only try to clean up and parse for solution type post

Can you elaborate?

@ailisp
Copy link
Collaborator

ailisp commented Nov 29, 2023

Can you elaborate?

I mean the parsing and clean up should only apply to Solution post, not all types of posts

supervisor = sponsorMatch ? sponsorMatch[1] : null;
}

const seekingFunding = amount !== null || token !== null || supervisor !== null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be problematic: if state.postType is not Solution, then amount, token and supervisor is all undefined, and this will be true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made these variables null by default to avoid this case

@@ -52,7 +63,7 @@ initState({
labelStrings,
postType,
name: props.name ?? "",
description: props.description ?? "",
description: cleanDescription(props.description) ?? "",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here we want to only cleanDescription if it's a solution type

Copy link
Contributor Author

@itexpert120 itexpert120 Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handled this case as well :)

@itexpert120 itexpert120 force-pushed the original-fields-while-editing branch from ce1a1f8 to 77503f9 Compare November 30, 2023 23:06
@itexpert120
Copy link
Contributor Author

rebased to main

Copy link
Collaborator

@ailisp ailisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me!

@ailisp ailisp merged commit 536b4f5 into NEAR-DevHub:main Dec 1, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User should see original fields when editing posts
2 participants