1UP : Code refractoring + trail modification and deletion

Words
368
Reading
2 min
Listen
Play
8y

alt

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.

alt

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

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

alt

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
1UP : Code refractoring + trail modification and deletion | Ecency