superseriousbusiness / gotosocial

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

[bug] sending empty expires_in to filter v2 endpoints sets expiration to now #3497

Open connyduck opened 1 day ago

connyduck commented 1 day ago

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

When creating or editing a filter v2, it is not possible to set the duration to indefinite.

What's your GoToSocial Version?

0.17.2-SNAPSHOT+git-1954ccb

GoToSocial Arch

goblin.technology

What happened?

I created a Filter like this:

POST https://goblin.technology/api/v2/filters
Content-Type: application/x-www-form-urlencoded
Content-Length: 63
Authorization: Bearer <>
User-Agent: Tusky/26.2-7008c48a Android/13 OkHttp/4.12.0
title=test123&context%5B%5D=home&filter_action=warn&expires_in=

I got the following response:

{
    "id": "01JBCS3BBG8QJAEQ2XCYTACXPC",
    "title": "test123",
    "context": [
        "home"
    ],
    "expires_at": "2024-10-29T18:37:35.984Z",
    "filter_action": "warn",
    "keywords": [],
    "statuses": []
}

As you can see, it has the expiration set to now. The same happens when editing the filter with PUT /api/v2/filters

What you expected to happen?

As per api docs and Mastodon behavior, I would expect the expiration to be indefinite.

How to reproduce it?

Create or edit a filter.

Anything else we need to know?

No response

tsmethurst commented 1 day ago

Ah thanks!