Today, for the first time in a long while, I'm able to carve out a whole day to work on #Macstodon . So like I did a few weeks back, this is going to be a "live" thread of my attempt to get bookmarks, boosts, and favourites implemented. Maybe replies too, if there's time. Maybe other things if it goes really well and there's lots of time.

#RetroProgramming

First of all, I just fixed the bug that allowed you to have multiple toots selected at once, across different timelines. That's kind of an important one because we need to know _which_ toot is selected in order to interact with it!

I _almost_ have bookmarks working. I wrote a helper function to find the selected toot and timeline that it belongs to, extract the ID, figure out if it's already been bookmarked or not, and make the appropriate API call.

For some reason the HTTP request is failing though, and I'm getting a generic "malformed URL" error, even though the URL is definitely correct, and other requests seem to work just fine. 😕​

OK, fixed it! I wasn't handling the case properly when POSTing to a URL with an empty post body. But it works, and now I can successfully bookmark a toot from within Macstodon 😁​

Unbookmarking doesn't work though - and I think I know why, it's because the previous state of the toot is cached in the timeline. So we don't know that the toot has _already_ been bookmarked, and that we need to unbookmark it instead. Shouldn't be too hard of a fix though.

why is caching so hard ugh
There we go, both bookmarking and unbookmarking work now! Fortunately I should be able to just copy/paste this code to make it work for boosts and favourites as well 😄

Bookmark/unbookmark, favourite/unfavourite, and boosting works now.

But _unboosting_ seems to silently fail for some reason. Not entirely sure why that is yet.

Fixed unboosting. Turns out, when you boost a toot, the API returns the _boosted_ toot, not the original (which makes sense). But you need to look at the _original_ toot to see if you've boosted it or not, and I was overwriting the timeline with the boosted toot.

One thing I want to do before tackling replies: displaying the current boost/favourite counts. That should be pretty easy, right?

Implemented reply, boost, and favourite counts. This required a small UI tweak but I think it turned out pretty good!

Next on the agenda today is implementing support for replies.

Replies are working!
@smallsco I love this project. Also, I miss ResEdit.