superseriousbusiness / gotosocial

Fast, fun, small ActivityPub server.
https://docs.gotosocial.org
GNU Affero General Public License v3.0
3.68k stars 311 forks source link

[bug] Enable "Discoverable" #1508

Closed Mushus closed 1 year ago

Mushus commented 1 year ago

Describe the bug with a clear and concise description of what the bug is.

Hello, thanks for this useful software!

I have recently been running my server using gotosocial. I have noticed that I am not getting crawled by the search engines. I read the source code of gotosocial and did what I could to change it by "discoverable". However, when I actually tried to configure my account using the API, I found that it was not ready to be enabled.

What's your GoToSocial Version?

0.7.0-rc3 git-700ed77

GoToSocial Arch

amd64 Docker

What happened?

I requested the URL "/api/v1/accounts/verify_credentials", but there is no "discoverable" in the response body.

What you expected to happen?

When "discoverable" is enabled using the "/api/v1/accounts/update_credentials" endpoint, "discoverable" must be present in the "/api/v1/accounts/verify_credentials" request body.

How to reproduce it?

# update "discoverable"
curl 'https://[host]/api/v1/accounts/update_credentials' \
  -X 'PATCH' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer [token]' \
  -H 'origin: https://[host]' \
  -H "Content-Type: application/x-www-form-urlencoded"  \
  -d "discoverable=true"

# find "discoverable"
curl 'https://[host]/api/v1/accounts/verify_credentials' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer token' \
  -H 'origin: https://[host]'

I have made my confirmation that this does not appear to be a problem with the account update feature.

select count(*) from accounts where discoverable = true;

I haven't gotten as far as debugging the gotosocial source code yet, but I think the next line might be the problem. accountFrontend.Discoverable is always a zero value (false) https://github.com/superseriousbusiness/gotosocial/blob/main/internal/typeutils/internaltofrontend.go#L201-L225

Anything else we need to know?

I can try to tackle this problem. I am willing to help.

tsmethurst commented 1 year ago

Thanks, well spotted! I'll make a fix now :)