Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Filters v1 #2594

Merged
merged 14 commits into from Mar 6, 2024
Merged

Conversation

VyrCossont
Copy link
Contributor

Description

This pull request implements a client-side filter API compatible with the Mastodon filter v1 API.

It does not implement the Mastodon filter v2 API, although it does add the DB and cache plumbing to trivially implement that API later. It also doesn't implement the server-side filtering part of the v1 API: the irreversible filter option will return an error message if set to true.

Fixes #1472

Checklist

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

@VyrCossont
Copy link
Contributor Author

There are two cache-related TODOs: one is for the multi-invalidate cache method that doesn't exist yet, and one is for cache memory ratios, which I don't understand.

The Swagger tool GtS uses seems to have a lot of bugs and omissions, so I'm not 100% on the Swagger parts.

@VyrCossont
Copy link
Contributor Author

Using the CI for golangci-lint run because it's 100% broken on my dev box. Sorry!

@tsmethurst tsmethurst changed the title Filters v1 [feature] Filters v1 Feb 1, 2024
VyrCossont added a commit to VyrCossont/gotosocial that referenced this pull request Feb 21, 2024
@JJGadgets

This comment was marked as off-topic.

@VyrCossont

This comment was marked as off-topic.

@VyrCossont

This comment was marked as off-topic.

@JJGadgets

This comment was marked as off-topic.

@JJGadgets

This comment was marked as off-topic.

@VyrCossont

This comment was marked as off-topic.

@VyrCossont VyrCossont closed this Feb 28, 2024
@VyrCossont VyrCossont reopened this Feb 28, 2024
@VyrCossont
Copy link
Contributor Author

Oops, that close was entirely accidental.

@VyrCossont
Copy link
Contributor Author

I take back my "this should work fine on 0.14"; there are some DB changes I need to rebase on top of first.

@VyrCossont
Copy link
Contributor Author

VyrCossont commented Feb 28, 2024

The unused code warnings are a false positive, possibly due to dominikh/go-tools#1440, and I've fixed the issue with GoLand custom folding region comments in go-critic/go-critic#1408. For now, I've added very specific exclusions to our linter config.

I have no idea why the docs build failed, but I haven't changed anything in the docs.

@JJGadgets

This comment was marked as off-topic.

@tsmethurst
Copy link
Contributor

The unused code warnings are a false positive, possibly due to dominikh/go-tools#1440, and I've fixed the issue with GoLand custom folding region comments in go-critic/go-critic#1408. For now, I've added very specific exclusions to our linter config.

I have no idea why the docs build failed, but I haven't changed anything in the docs.

I'll check it out :)

test/envparsing.sh Outdated Show resolved Hide resolved
@tsmethurst
Copy link
Contributor

Not sure why the docs build failed, but I'll kick it :)

@daenney
Copy link
Member

daenney commented Feb 29, 2024

As a point of order, can we please keep the "how does this work and does it work with my favourite client" discussion to a minimum going forwards? It causes a bunch of notifications and it's not relevant to the change itself. There's a Matrix room for this kind of discussion.

@tsmethurst
Copy link
Contributor

This is looking almost ready to go 👀 Just a few discussions left to resolve. Thanks for your continued hard work @VyrCossont !

This is an operation that the Mastodon v2 filter API doesn't actually have, because filter statuses, unlike keywords, don't have options: the only info they contain is the status ID to be filtered.
case float64:
form.ExpiresIn = util.Ptr(int(e))

case string:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we be expecting this as a string? this feels wrong. or is this mastodon normalized behaviour we're stuck with :p

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same set of types accepted by the poll expiration time mechanism, so I assume we've seen that happen at least once 😞

Our existing linters should catch these, or they don't matter very much
@tsmethurst tsmethurst merged commit 61a2b91 into superseriousbusiness:main Mar 6, 2024
2 checks passed
@VyrCossont VyrCossont deleted the filters-v1 branch March 6, 2024 13:29
@nikclayton

This comment was marked as off-topic.

@tsmethurst

This comment was marked as off-topic.

@nikclayton

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] filter / mute words and hashtags
6 participants