[feature] User muting (#2960)

* User muting

* Address review feedback

* Rename uniqueness constraint on user_mutes to match convention

* Remove unused account_id from where clause

* Add UserMute to NewTestDB

* Update test/envparsing.sh with new and fixed cache stuff

* Address tobi's review comments

* Make compiledUserMuteListEntry.expired consistent with UserMute.Expired

* Make sure mute_expires_at is serialized as an explicit null for indefinite mutes

---------

Co-authored-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
Vyr Cossont
2024-06-06 09:38:02 -07:00
committed by GitHub
parent b371c2db47
commit 5e2d4fdb19
47 changed files with 2346 additions and 53 deletions

View File

@@ -187,4 +187,25 @@ type Relationship interface {
// PopulateNote populates the struct pointers on the given note.
PopulateNote(ctx context.Context, note *gtsmodel.AccountNote) error
// IsMuted checks whether source account has a mute in place against target.
IsMuted(ctx context.Context, sourceAccountID string, targetAccountID string) (bool, error)
// GetMuteByID fetches mute with given ID from the database.
GetMuteByID(ctx context.Context, id string) (*gtsmodel.UserMute, error)
// GetMute returns the mute from account1 targeting account2, if it exists, or an error if it doesn't.
GetMute(ctx context.Context, account1 string, account2 string) (*gtsmodel.UserMute, error)
// PutMute attempts to insert or update the given account mute in the database.
PutMute(ctx context.Context, mute *gtsmodel.UserMute) error
// DeleteMuteByID removes mute with given ID from the database.
DeleteMuteByID(ctx context.Context, id string) error
// DeleteAccountMutes will delete all database mutes to / from the given account ID.
DeleteAccountMutes(ctx context.Context, accountID string) error
// GetAccountMutes returns all mutes originating from the given account, with given optional paging parameters.
GetAccountMutes(ctx context.Context, accountID string, paging *paging.Page) ([]*gtsmodel.UserMute, error)
}