tags, emoji

This commit is contained in:
tsmethurst
2021-04-04 19:20:31 +02:00
parent bf93305931
commit 1710158b39
5 changed files with 163 additions and 8 deletions

View File

@ -188,10 +188,29 @@ type DB interface {
// In other words, this is the public record that the server has of an account.
AccountToMastoPublic(account *model.Account) (*mastotypes.Account, error)
// AccountStringsToMentions takes a slice of deduplicated account names in the form "@test@whatever.example.org", which have been
// MentionStringsToMentions takes a slice of deduplicated, lowercase account names in the form "@test@whatever.example.org", which have been
// mentioned in a status. It takes the id of the account that wrote the status, and the id of the status itself, and then
// checks in the database for the mentioned accounts, and returns a slice of mentions generated based on the given parameters.
AccountStringsToMentions(targetAccounts []string, originAccountID string, statusID string) ([]*model.Mention, error)
//
// Note: this func doesn't/shouldn't do any manipulation of the accounts in the DB, it's just for checking if they exist
// and conveniently returning them.
MentionStringsToMentions(targetAccounts []string, originAccountID string, statusID string) ([]*model.Mention, error)
// TagStringsToTags takes a slice of deduplicated, lowercase tags in the form "somehashtag", which have been
// used in a status. It takes the id of the account that wrote the status, and the id of the status itself, and then
// returns a slice of *model.Tag corresponding to the given tags.
//
// Note: this func doesn't/shouldn't do any manipulation of the tags in the DB, it's just for checking if they exist
// and conveniently returning them.
TagStringsToTags(tags []string, originAccountID string, statusID string) ([]*model.Tag, error)
// EmojiStringsToEmojis takes a slice of deduplicated, lowercase emojis in the form ":emojiname:", which have been
// used in a status. It takes the id of the account that wrote the status, and the id of the status itself, and then
// returns a slice of *model.Emoji corresponding to the given emojis.
//
// Note: this func doesn't/shouldn't do any manipulation of the emoji in the DB, it's just for checking if they exist
// and conveniently returning them.
EmojiStringsToEmojis(emojis []string, originAccountID string, statusID string) ([]*model.Emoji, error)
}
// New returns a new database service that satisfies the DB interface and, by extension,