Inbox post (#22)

Inbox POST from federated servers now working for statuses and follow requests.
    Follow request client API added.
    Start work on federating outgoing messages.
    Other fixes and changes/tidying up.
This commit is contained in:
Tobi Smethurst
2021-05-15 11:58:11 +02:00
committed by GitHub
parent 742f985d5b
commit cc48294c31
58 changed files with 2248 additions and 366 deletions

View File

@ -76,15 +76,15 @@ type Account struct {
*/
// Does this account need an approval for new followers?
Locked bool `pg:",default:true"`
Locked bool `pg:",default:'true'"`
// Should this account be shown in the instance's profile directory?
Discoverable bool
// Default post privacy for this account
Privacy Visibility
// Set posts from this account to sensitive by default?
Sensitive bool `pg:",default:false"`
Sensitive bool `pg:",default:'false'"`
// What language does this account post in?
Language string `pg:",default:en"`
Language string `pg:",default:'en'"`
/*
ACTIVITYPUB THINGS

View File

@ -30,10 +30,22 @@ type Mention struct {
CreatedAt time.Time `pg:"type:timestamp,notnull,default:now()"`
// When was this mention last updated?
UpdatedAt time.Time `pg:"type:timestamp,notnull,default:now()"`
// Who created this mention?
// What's the internal account ID of the originator of the mention?
OriginAccountID string `pg:",notnull"`
// Who does this mention target?
// What's the AP URI of the originator of the mention?
OriginAccountURI string `pg:",notnull"`
// What's the internal account ID of the mention target?
TargetAccountID string `pg:",notnull"`
// Prevent this mention from generating a notification?
Silent bool
// NameString is for putting in the namestring of the mentioned user
// before the mention is dereferenced. Should be in a form along the lines of:
// @whatever_username@example.org
//
// This will not be put in the database, it's just for convenience.
NameString string `pg:"-"`
// MentionedAccountURI is the AP ID (uri) of the user mentioned.
//
// This will not be put in the database, it's just for convenience.
MentionedAccountURI string `pg:"-"`
}

View File

@ -71,12 +71,14 @@ type Status struct {
Text string
/*
NON-DATABASE FIELDS
INTERNAL MODEL NON-DATABASE FIELDS
These are for convenience while passing the status around internally,
but these fields should *never* be put in the db.
*/
// Account that created this status
GTSAccount *Account `pg:"-"`
// Mentions created in this status
GTSMentions []*Mention `pg:"-"`
// Hashtags used in this status
@ -93,6 +95,20 @@ type Status struct {
GTSBoostedStatus *Status `pg:"-"`
// Account of the boosted status
GTSBoostedAccount *Account `pg:"-"`
/*
AP NON-DATABASE FIELDS
These are for convenience while passing the status around internally,
but these fields should *never* be put in the db.
*/
// AP URI of the status being replied to.
// Useful when that status doesn't exist in the database yet and we still need to dereference it.
APReplyToStatusURI string `pg:"-"`
// The AP URI of the owner/creator of the status.
// Useful when that account doesn't exist in the database yet and we still need to dereference it.
APStatusOwnerURI string `pg:"-"`
}
// Visibility represents the visibility granularity of a status.

View File

@ -24,6 +24,8 @@ import "time"
type Tag struct {
// id of this tag in the database
ID string `pg:",unique,type:uuid,default:gen_random_uuid(),pk,notnull"`
// Href of this tag, eg https://example.org/tags/somehashtag
URL string
// name of this tag -- the tag without the hash part
Name string `pg:",unique,pk,notnull"`
// Which account ID is the first one we saw using this tag?