1UP : Code refractoring + trail modification and deletion

in #utopian-io6 years ago (edited)

Repository

https://github.com/therealFlauwy/1UP

Following this post from @flauwy, I've been tasked to start the creation of the new 1UP.
As a reminder, @utopian-1UP was an Utopian bot front-runner in which members of the community would decide which are the best posts to vote for. the @utopian-1up would then vote for the best post every 2.4 hours, followed by hundreds of curators in the trail.

What s new?


Code refractoring

The code started to become quite heavy so I thought it was time for some refractoring, putting the routes in different files according to their use : for communities, for trails, etc.

The functions are defined in utils.js and can be called from any of those routes.

Lots of work has been done on the getSession function that allows to get information about the user.
Indeed, users can be related to a community in many different ways, and we need this information. For each user we need to get :

  • Which communities the user is either an admin, moderator or owner.
  • Which communities the user is trailing
  • Which community the user is acting as a trail tail (if any)

For reminder, what I call the trail tail, is the last account voting on the trail, the community whale.

Updating and deleting the trail

Whether being a normal trailing account or the trail tail, users can edit or remove their participation to the trail from the View page.

New PATCH and DELETE routes have been created for both the Trail and TrailTail objects.
The CSS will soon be added by @flauwy.

Administrators can also remove the trail tail from the Edit page.

Future work

  • Fetch the posts the post corresponding to the community criteria
  • Display these posts and allow 1UP votes on it
  • Vote on the best post of the period

Live Demo

As a demonstration speaks more than lots of words, I ve put back online the old Utopian1UP website. You can try by yourself and create a community and link a trail to it for testing purposes.
No votes will be casted do not worry, but it's an offline token so, for safety reasons, I would recommend using a test account.

Live Demo

Pull Request

Edit and delete trails

GitHub Account

https://github.com/stoodkev


Meet me at SteemFest 2018 in Kraków

Sort:  
  • Great refactoring and new features.
  • Don't be afraid to show off your code in the post.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @helo!

So far this week you've reviewed 4 contributions. Keep up the good work!

That is amazing!!............

Nice, the settings are done. Next step: 1UP-pping! :P

Interesting - great to hear about the progress :D

Hi @stoodkev!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Coin Marketplace

STEEM 0.31
TRX 0.11
JST 0.034
BTC 64332.82
ETH 3146.25
USDT 1.00
SBD 4.17