This repository has been archived by the owner on May 7, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's new
When logged into KURE, you will see the pencil icon. When you click on it, it brings you to the
write
page. Here you can compose your post. Just put in a title and a post body, as well as 1 to 5 tags, and you're set.When you post a loading spinner will show up indicating the post is being processed and sent to the Steem blockchain. After about 3 seconds, the post will be successful and you will see your new post in front of you. When you go to your blog page, you can see your new post listed there as a post summary as well.
Once the data is passed to Redux, the data is processed more, such as creating the permlink to be used for the URL to access the post. Some options are added to the post, which include the author, permlink, and whether to allow votes and curation, and the payout type.
The last thing to do before sending the post away to Steem via SteemConnect, is to check if the user has posted 5 minutes earlier (from the same computer). I haven't thought about how to check if someone has posted another way. Maybe I should get their last post and the created time from there, that would be a better idea. For now, an error message about the 5 minute limit is sent if they use the same computer. If not, then the post simply won't go through anyways.
being limited to one payout option would be a bummer. After I got posting to work I added all options. The default payout option for now is 50/50 SBD/STEEM split. But you can also choose
100% STEEM
andDecline Payout
, as I did here.An array of values is iterated through and rendered as a option box for users to select from.
On the Redux side, if the default of 50/50 isn't the selection, a change is made to the
reward
value to be sent to Steem.When you write your post and pick tags, there is also some validation going on for the tags. When you submit your post and made an invalid tag choice, you will be told about it and need to change it before your post can be posted.
Tags are validated via regex according to certain matches. This includes tags being required,
Maximum 5 tags.
,Tags must be shorter than 24 chars.
,Only one dash per tag,
Only one dash per tag,
Must be lowercase,
Invalid characters,
Must start with letter, and
Must end with letter or number`.Bug Fixes
When logging into the app, and not a return authentication, the user token was not being reset in to the SteemConnect api. This shortcoming resulted in an inability to send Posts to the Steem blockhain via SteemConnect.
Instead, there was an error:
The token has invalid role
With @fabien's help, he showed me that the authentication headers were not being set and therefore no token was being sent to SteemConnect to send the post to Steem.
Once I
setAccessToken
and verified the token with.me()
, I was able to post to Steem, finally.When I made my first post on KURE, and added the rerouting to the post to show it after it was posted, I got a page crash. This was unexpected. At first I got this error when the posting wasn't working, but the permlink was created and forwarded to a page that doesn't exist.
Non existent posts being fetched were not being handled, only non-existent routes. I had to add some more checks before sending a post to the PostDetails component. If the post is not being fetched, and it has no length, then the post doesn't exist.
Related to the above issue with authentication, is another problem that I noticed when a token was no longer valid. Anyone who wass previously logged in and had a cookie set, had their token stored there. But, if the token expired or was revoked (as I did when I tested this), then the user would still be "logged in" to the app and see the Manage and Write menu pages to write a Steem post.
Yet, if they tried to write a Steem post, it would fail, because their token wasn't valid anymore. I needed to change the way the returning users were being authenticated. TO do so, I had to remove a default
resolve()
in the Promise forvalidateToken
. This way when theme(0
function failed, that error would cascade up to Promise chain and be caught in acatch
which dispatched an error to cancel the returning action and reducer.Unauthorized access to the Manage page would show a message saying that the user needed to login. But after I made some changes, it stopped working and would show the loading spinner forever.
With the recent changes in the authentication of the SteemConnect token, the Redux action wasn't being canceled, so the loading spinner stayed in a state of true indefinitely. Dispatching an action on error to change the state to false fixed the issue.
Sending an error message when a post is submitted less than 5 minutes after a post was sent, still had the post trying to be sent to Steem. I added a conditional return.
The error label for time limit was showing up under the Submit button, instead of beside it. By putting the button and label in a Semantic-React UI
Form.Group
made them related and the alignment of the label worked.Trying to fetch data right after a post, was sometimes done too quickly and returned no results. By adding a 1 second delay after a post was sent, it ensured the lookup wasn't done too quickly, and when the lookup was done that the post would exist for it to find.
Lastly, an empty post would still show the
Comments
header and the sorting option box. This was pointless and added to a negative UI/UX design. Wrapping the comments section in a conditional to test forcomments.length
prevented it from showing when there were no comments. Note the double negation!!
. If you don't put that, then a 0 is outputted to the page when there are no comments.