mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 02:22:26 -05:00
feature: filters v2 server-side warning/hiding (#2793)
* Remove dead code * Filter statuses when converting to frontend representation * status.filtered is an array * Make matching case-insensitive * Remove TODOs that don't need to be done now * Add missing filter check for notification * lint: rename ErrHideStatus * APIFilterActionToFilterAction not used yet * swaggerino docseroni * Address review comments * Add apimodel.FilterActionNone --------- Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com> Co-authored-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
parent
a0d066844f
commit
45f4afe60e
24 changed files with 855 additions and 130 deletions
45
internal/filter/status/status.go
Normal file
45
internal/filter/status/status.go
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// GoToSocial
|
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Package status represents status filters managed by the user through the API.
|
||||
package status
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
// ErrHideStatus indicates that a status has been filtered and should not be returned at all.
|
||||
var ErrHideStatus = errors.New("hide status")
|
||||
|
||||
// FilterContext determines the filters that apply to a given status or list of statuses.
|
||||
type FilterContext string
|
||||
|
||||
const (
|
||||
// FilterContextNone means no filters should be applied.
|
||||
// There are no filters with this context; it's for internal use only.
|
||||
FilterContextNone FilterContext = ""
|
||||
// FilterContextHome means this status is being filtered as part of a home or list timeline.
|
||||
FilterContextHome FilterContext = "home"
|
||||
// FilterContextNotifications means this status is being filtered as part of the notifications timeline.
|
||||
FilterContextNotifications FilterContext = "notifications"
|
||||
// FilterContextPublic means this status is being filtered as part of a public or tag timeline.
|
||||
FilterContextPublic FilterContext = "public"
|
||||
// FilterContextThread means this status is being filtered as part of a thread's context.
|
||||
FilterContextThread FilterContext = "thread"
|
||||
// FilterContextAccount means this status is being filtered as part of an account's statuses.
|
||||
FilterContextAccount FilterContext = "account"
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue