Broadcast a new post + bug fixes

in #utopian-io8 years ago (edited)

Link to PR here

Solves issues:

Bug Fixes

  • Leaderboard sorting incorrectly
    The leaderboard had a bug where it was sorting users alphabetically by a.username > b.username and this evaluates to a boolean. The sort function needs a number -1, 0, 1 and therefore didn't sort correctly. Instead I simply let the algorithm sort by first posts, then votes.

image

  • Not error handling broadcast issues correctly
    Made these async functions with try/catch blocks to cover any exceptions.

New Features

Added the ability to post. Simply submit a valid Post object which is defined as:

export class Post {
    // STEEM Blockchain
    author: string;
    permlink: string;
    created: string;
    title: string;
    body: string;
    votes: number;
    jsonMetadata: JsonMetadata;

    // SQL
    did_comment: boolean;
    did_vote: boolean;
}

It ignores the author variable and uses the STEEM_USERNAME environment variable with the STEEM_PASSWORD environment variable. This basically finishes up the "Broadcast" file as you can now post, comment, and vote. Posting can be thought of as simply commenting on a null object.

Now Playing

Check out the #nowplaying community and bot in action here



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.

[utopian-moderator]

Hey @walnut1 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.04
TRX 0.33
JST 0.101
BTC 64341.40
ETH 1825.11
USDT 1.00
SBD 0.38