mastodon / mastodon

Your self-hosted, globally interconnected microblogging community
https://joinmastodon.org
GNU Affero General Public License v3.0
46.99k stars 6.95k forks source link

Return reblogs_count in accounts API? #24102

Open leobm opened 1 year ago

leobm commented 1 year ago

Pitch

Today I noticed that it would be nice if in the accounts API (https://docs.joinmastodon.org/methods/accounts/#get) the number of reblogs would be returned (e.g. under reblogs_count). Maybe for replies this would be interesting too, so a value replies_count. I can determine these values myself, but there would be quite a lot of requests in the statuses API.

Motivation

For reporting and deciding if I should follow a user. E.g. you could decide to unfollow someone where more than 40% of their posts are reposts (reblogs)

trwnh commented 1 year ago

i'm confused -- what do you mean "reblogs count" and "replies count"? you can't reblog or reply to an account, you can only do those to a status

leobm commented 1 year ago

@trwnh I mean the count (for my own (or of a user by ID) reblogs and replies) over all my statuses. So similar to statuses_count, which I get via the same API.

if I have correctly determined the values for my account (https://norden.social/@leobm), via the statuses API, I get the following numbers: statuses_count=2197 via /api/v1/accounts/51563/statuses?limit=40&exclude_replies=false&exclude_reblogs=false In principle, I can use this to get the "same" number that I get from the accounts API.

reblogs_count=2197-2133=64 or via /api/v1/accounts/51563/statuses?limit=40&exclude_replies=false&exclude_reblogs=true

replies_count=2197-383=1.814 or via /api/v1/accounts/51563/statuses?limit=40&exclude_replies=true&exclude_reblogs=false

But this costs a lot of API requests, if you get these values from the statuses API (if you have a lot of statuses). You could also count up these values when you create a new status.

In principle, these would be cached values for each account and its associated statuses.