n1k0 / tooty

An alternative multi-accounts Web client for Mastodon.
https://n1k0.github.io/tooty/v2/
157 stars 9 forks source link

Fix #196: Fix incompatibilities with the Mastodon API v2.0.0. #197

Closed n1k0 closed 6 years ago

n1k0 commented 7 years ago

This is an attempt at fixing breaking changes with the Mastodon API v2.0.0 (#196), notably those where the unique ids are now strings instead of ints.

The fix ensures previous Mastodon server versions are still working properly.

Users are invited to test this patch locally and give their feedback on this issue if anything is broken or missing.

n1k0 commented 7 years ago

Ideally we should abstract all the id fields so they have their own type, eg.

type StatusId = StatusId String

Reasoning being, as per rtfeldman's example SPA:

Identifiers such as CommentId, Username, and Slug - which are used to uniquely identify comments, users, and articles, respectively - are implemented as union types. If we used e.g. type alias Username = String, we could mistakenly pass a Username to an API call expecting a Slug, and it would still compile. We can rule bugs like that out by implementing identifiers as union types.

That's a bunch of code to update and I'm kinda lazy these days, so any help doing so would be greatly appreciated.

DirtyF commented 7 years ago

That's a bunch of code to update and I'm kinda lazy these days, so any help doing so would be greatly appreciated.

n1k0 seems like a good candidate for hacktoberfest 🍺

n1k0 commented 7 years ago

Ah, I know nothing about it and just spent all my available amount of time dedicated to do something other than enjoying my weekend, would you mind taking care of that? :)

n1k0 commented 7 years ago

If anyone is interested into contributing, I've migrated the Status record type to use a specific type for status ids in https://github.com/n1k0/tooty/pull/197/commits/418bac1bb05695412585434911cf51dd4e811f16.

We should do the same for Account, Media and every other entity having a string id.

bnjbvr commented 7 years ago

Thanks for giving it a look so quickly, and sorry to undermine your weekend! When I try this PR, npm install and package and npm start, I run into the following error when accessing /:

Trying to initialize the `Main` module with an unexpected flag.
I tried to convert it to an Elm value, but ran into this problem:

Expecting a String at _.clients but instead got: null

Is there something I am doing wrong?

n1k0 commented 7 years ago

@bnjbvr Can you please update and check again? Thanks!

bnjbvr commented 7 years ago

Works like a charm, thank you so much!

n1k0 commented 6 years ago

Things should be working entirely now, I've deployed this branch to production at https://n1k0.github.io/tooty/

Feedback would be much appreciated!

bnjbvr commented 6 years ago

Works like a charm, thank you very much!

chantoine commented 6 years ago

Salut !

Things should be working entirely now, I've deployed this branch to production at https://n1k0.github.io/tooty/
Feedback would be much appreciated!

Great !

Just DL gh-pages.zip, updated and... it works again :-)

Thanks !!!

--
Cordialement
**Christophe ANTOINE
**site internet : cabinet-antoine.fr