mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2026-01-06 14:03:18 -06:00
Follows and relationships (#27)
* Follows -- create and undo, both remote and local * Statuses -- federate new posts, including media, attachments, CWs and image descriptions.
This commit is contained in:
parent
dc06e71b76
commit
d839f27c30
54 changed files with 2260 additions and 299 deletions
|
|
@ -76,13 +76,13 @@ type Account struct {
|
|||
*/
|
||||
|
||||
// Does this account need an approval for new followers?
|
||||
Locked bool `pg:",default:'true'"`
|
||||
Locked bool
|
||||
// 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
|
||||
// What language does this account post in?
|
||||
Language string `pg:",default:'en'"`
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ type Account struct {
|
|||
// URL for getting the featured collection list of this account
|
||||
FeaturedCollectionURI string `pg:",unique"`
|
||||
// What type of activitypub actor is this account?
|
||||
ActorType ActivityStreamsActor
|
||||
ActorType string
|
||||
// This account is associated with x account id
|
||||
AlsoKnownAs string
|
||||
|
||||
|
|
|
|||
|
|
@ -18,110 +18,101 @@
|
|||
|
||||
package gtsmodel
|
||||
|
||||
// ActivityStreamsObject refers to https://www.w3.org/TR/activitystreams-vocabulary/#object-types
|
||||
type ActivityStreamsObject string
|
||||
|
||||
const (
|
||||
// ActivityStreamsArticle https://www.w3.org/TR/activitystreams-vocabulary/#dfn-article
|
||||
ActivityStreamsArticle ActivityStreamsObject = "Article"
|
||||
ActivityStreamsArticle = "Article"
|
||||
// ActivityStreamsAudio https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audio
|
||||
ActivityStreamsAudio ActivityStreamsObject = "Audio"
|
||||
ActivityStreamsAudio = "Audio"
|
||||
// ActivityStreamsDocument https://www.w3.org/TR/activitystreams-vocabulary/#dfn-document
|
||||
ActivityStreamsDocument ActivityStreamsObject = "Event"
|
||||
ActivityStreamsDocument = "Event"
|
||||
// ActivityStreamsEvent https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event
|
||||
ActivityStreamsEvent ActivityStreamsObject = "Event"
|
||||
ActivityStreamsEvent = "Event"
|
||||
// ActivityStreamsImage https://www.w3.org/TR/activitystreams-vocabulary/#dfn-image
|
||||
ActivityStreamsImage ActivityStreamsObject = "Image"
|
||||
ActivityStreamsImage = "Image"
|
||||
// ActivityStreamsNote https://www.w3.org/TR/activitystreams-vocabulary/#dfn-note
|
||||
ActivityStreamsNote ActivityStreamsObject = "Note"
|
||||
ActivityStreamsNote = "Note"
|
||||
// ActivityStreamsPage https://www.w3.org/TR/activitystreams-vocabulary/#dfn-page
|
||||
ActivityStreamsPage ActivityStreamsObject = "Page"
|
||||
ActivityStreamsPage = "Page"
|
||||
// ActivityStreamsPlace https://www.w3.org/TR/activitystreams-vocabulary/#dfn-place
|
||||
ActivityStreamsPlace ActivityStreamsObject = "Place"
|
||||
ActivityStreamsPlace = "Place"
|
||||
// ActivityStreamsProfile https://www.w3.org/TR/activitystreams-vocabulary/#dfn-profile
|
||||
ActivityStreamsProfile ActivityStreamsObject = "Profile"
|
||||
ActivityStreamsProfile = "Profile"
|
||||
// ActivityStreamsRelationship https://www.w3.org/TR/activitystreams-vocabulary/#dfn-relationship
|
||||
ActivityStreamsRelationship ActivityStreamsObject = "Relationship"
|
||||
ActivityStreamsRelationship = "Relationship"
|
||||
// ActivityStreamsTombstone https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tombstone
|
||||
ActivityStreamsTombstone ActivityStreamsObject = "Tombstone"
|
||||
ActivityStreamsTombstone = "Tombstone"
|
||||
// ActivityStreamsVideo https://www.w3.org/TR/activitystreams-vocabulary/#dfn-video
|
||||
ActivityStreamsVideo ActivityStreamsObject = "Video"
|
||||
ActivityStreamsVideo = "Video"
|
||||
)
|
||||
|
||||
// ActivityStreamsActor refers to https://www.w3.org/TR/activitystreams-vocabulary/#actor-types
|
||||
type ActivityStreamsActor string
|
||||
|
||||
const (
|
||||
// ActivityStreamsApplication https://www.w3.org/TR/activitystreams-vocabulary/#dfn-application
|
||||
ActivityStreamsApplication ActivityStreamsActor = "Application"
|
||||
ActivityStreamsApplication = "Application"
|
||||
// ActivityStreamsGroup https://www.w3.org/TR/activitystreams-vocabulary/#dfn-group
|
||||
ActivityStreamsGroup ActivityStreamsActor = "Group"
|
||||
ActivityStreamsGroup = "Group"
|
||||
// ActivityStreamsOrganization https://www.w3.org/TR/activitystreams-vocabulary/#dfn-organization
|
||||
ActivityStreamsOrganization ActivityStreamsActor = "Organization"
|
||||
ActivityStreamsOrganization = "Organization"
|
||||
// ActivityStreamsPerson https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person
|
||||
ActivityStreamsPerson ActivityStreamsActor = "Person"
|
||||
ActivityStreamsPerson = "Person"
|
||||
// ActivityStreamsService https://www.w3.org/TR/activitystreams-vocabulary/#dfn-service
|
||||
ActivityStreamsService ActivityStreamsActor = "Service"
|
||||
ActivityStreamsService = "Service"
|
||||
)
|
||||
|
||||
// ActivityStreamsActivity refers to https://www.w3.org/TR/activitystreams-vocabulary/#activity-types
|
||||
type ActivityStreamsActivity string
|
||||
|
||||
const (
|
||||
// ActivityStreamsAccept https://www.w3.org/TR/activitystreams-vocabulary/#dfn-accept
|
||||
ActivityStreamsAccept ActivityStreamsActivity = "Accept"
|
||||
ActivityStreamsAccept = "Accept"
|
||||
// ActivityStreamsAdd https://www.w3.org/TR/activitystreams-vocabulary/#dfn-add
|
||||
ActivityStreamsAdd ActivityStreamsActivity = "Add"
|
||||
ActivityStreamsAdd = "Add"
|
||||
// ActivityStreamsAnnounce https://www.w3.org/TR/activitystreams-vocabulary/#dfn-announce
|
||||
ActivityStreamsAnnounce ActivityStreamsActivity = "Announce"
|
||||
ActivityStreamsAnnounce = "Announce"
|
||||
// ActivityStreamsArrive https://www.w3.org/TR/activitystreams-vocabulary/#dfn-arrive
|
||||
ActivityStreamsArrive ActivityStreamsActivity = "Arrive"
|
||||
ActivityStreamsArrive = "Arrive"
|
||||
// ActivityStreamsBlock https://www.w3.org/TR/activitystreams-vocabulary/#dfn-block
|
||||
ActivityStreamsBlock ActivityStreamsActivity = "Block"
|
||||
ActivityStreamsBlock = "Block"
|
||||
// ActivityStreamsCreate https://www.w3.org/TR/activitystreams-vocabulary/#dfn-create
|
||||
ActivityStreamsCreate ActivityStreamsActivity = "Create"
|
||||
ActivityStreamsCreate = "Create"
|
||||
// ActivityStreamsDelete https://www.w3.org/TR/activitystreams-vocabulary/#dfn-delete
|
||||
ActivityStreamsDelete ActivityStreamsActivity = "Delete"
|
||||
ActivityStreamsDelete = "Delete"
|
||||
// ActivityStreamsDislike https://www.w3.org/TR/activitystreams-vocabulary/#dfn-dislike
|
||||
ActivityStreamsDislike ActivityStreamsActivity = "Dislike"
|
||||
ActivityStreamsDislike = "Dislike"
|
||||
// ActivityStreamsFlag https://www.w3.org/TR/activitystreams-vocabulary/#dfn-flag
|
||||
ActivityStreamsFlag ActivityStreamsActivity = "Flag"
|
||||
ActivityStreamsFlag = "Flag"
|
||||
// ActivityStreamsFollow https://www.w3.org/TR/activitystreams-vocabulary/#dfn-follow
|
||||
ActivityStreamsFollow ActivityStreamsActivity = "Follow"
|
||||
ActivityStreamsFollow = "Follow"
|
||||
// ActivityStreamsIgnore https://www.w3.org/TR/activitystreams-vocabulary/#dfn-ignore
|
||||
ActivityStreamsIgnore ActivityStreamsActivity = "Ignore"
|
||||
ActivityStreamsIgnore = "Ignore"
|
||||
// ActivityStreamsInvite https://www.w3.org/TR/activitystreams-vocabulary/#dfn-invite
|
||||
ActivityStreamsInvite ActivityStreamsActivity = "Invite"
|
||||
ActivityStreamsInvite = "Invite"
|
||||
// ActivityStreamsJoin https://www.w3.org/TR/activitystreams-vocabulary/#dfn-join
|
||||
ActivityStreamsJoin ActivityStreamsActivity = "Join"
|
||||
ActivityStreamsJoin = "Join"
|
||||
// ActivityStreamsLeave https://www.w3.org/TR/activitystreams-vocabulary/#dfn-leave
|
||||
ActivityStreamsLeave ActivityStreamsActivity = "Leave"
|
||||
ActivityStreamsLeave = "Leave"
|
||||
// ActivityStreamsLike https://www.w3.org/TR/activitystreams-vocabulary/#dfn-like
|
||||
ActivityStreamsLike ActivityStreamsActivity = "Like"
|
||||
ActivityStreamsLike = "Like"
|
||||
// ActivityStreamsListen https://www.w3.org/TR/activitystreams-vocabulary/#dfn-listen
|
||||
ActivityStreamsListen ActivityStreamsActivity = "Listen"
|
||||
ActivityStreamsListen = "Listen"
|
||||
// ActivityStreamsMove https://www.w3.org/TR/activitystreams-vocabulary/#dfn-move
|
||||
ActivityStreamsMove ActivityStreamsActivity = "Move"
|
||||
ActivityStreamsMove = "Move"
|
||||
// ActivityStreamsOffer https://www.w3.org/TR/activitystreams-vocabulary/#dfn-offer
|
||||
ActivityStreamsOffer ActivityStreamsActivity = "Offer"
|
||||
ActivityStreamsOffer = "Offer"
|
||||
// ActivityStreamsQuestion https://www.w3.org/TR/activitystreams-vocabulary/#dfn-question
|
||||
ActivityStreamsQuestion ActivityStreamsActivity = "Question"
|
||||
ActivityStreamsQuestion = "Question"
|
||||
// ActivityStreamsReject https://www.w3.org/TR/activitystreams-vocabulary/#dfn-reject
|
||||
ActivityStreamsReject ActivityStreamsActivity = "Reject"
|
||||
ActivityStreamsReject = "Reject"
|
||||
// ActivityStreamsRead https://www.w3.org/TR/activitystreams-vocabulary/#dfn-read
|
||||
ActivityStreamsRead ActivityStreamsActivity = "Read"
|
||||
ActivityStreamsRead = "Read"
|
||||
// ActivityStreamsRemove https://www.w3.org/TR/activitystreams-vocabulary/#dfn-remove
|
||||
ActivityStreamsRemove ActivityStreamsActivity = "Remove"
|
||||
ActivityStreamsRemove = "Remove"
|
||||
// ActivityStreamsTentativeReject https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tentativereject
|
||||
ActivityStreamsTentativeReject ActivityStreamsActivity = "TentativeReject"
|
||||
ActivityStreamsTentativeReject = "TentativeReject"
|
||||
// ActivityStreamsTentativeAccept https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tentativeaccept
|
||||
ActivityStreamsTentativeAccept ActivityStreamsActivity = "TentativeAccept"
|
||||
ActivityStreamsTentativeAccept = "TentativeAccept"
|
||||
// ActivityStreamsTravel https://www.w3.org/TR/activitystreams-vocabulary/#dfn-travel
|
||||
ActivityStreamsTravel ActivityStreamsActivity = "Travel"
|
||||
ActivityStreamsTravel = "Travel"
|
||||
// ActivityStreamsUndo https://www.w3.org/TR/activitystreams-vocabulary/#dfn-undo
|
||||
ActivityStreamsUndo ActivityStreamsActivity = "Undo"
|
||||
ActivityStreamsUndo = "Undo"
|
||||
// ActivityStreamsUpdate https://www.w3.org/TR/activitystreams-vocabulary/#dfn-update
|
||||
ActivityStreamsUpdate ActivityStreamsActivity = "Update"
|
||||
ActivityStreamsUpdate = "Update"
|
||||
// ActivityStreamsView https://www.w3.org/TR/activitystreams-vocabulary/#dfn-view
|
||||
ActivityStreamsView ActivityStreamsActivity = "View"
|
||||
ActivityStreamsView = "View"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -38,6 +38,14 @@ type Mention struct {
|
|||
TargetAccountID string `pg:",notnull"`
|
||||
// Prevent this mention from generating a notification?
|
||||
Silent bool
|
||||
|
||||
/*
|
||||
NON-DATABASE CONVENIENCE FIELDS
|
||||
These fields are just for convenience while passing the mention
|
||||
around internally, to make fewer database calls and whatnot. They're
|
||||
not meant to be put in the database!
|
||||
*/
|
||||
|
||||
// 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
|
||||
|
|
@ -48,4 +56,6 @@ type Mention struct {
|
|||
//
|
||||
// This will not be put in the database, it's just for convenience.
|
||||
MentionedAccountURI string `pg:"-"`
|
||||
// A pointer to the gtsmodel account of the mentioned account.
|
||||
GTSAccount *Account `pg:"-"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@ package gtsmodel
|
|||
|
||||
// FromClientAPI wraps a message that travels from client API into the processor
|
||||
type FromClientAPI struct {
|
||||
APObjectType ActivityStreamsObject
|
||||
APActivityType ActivityStreamsActivity
|
||||
APObjectType string
|
||||
APActivityType string
|
||||
GTSModel interface{}
|
||||
OriginAccount *Account
|
||||
TargetAccount *Account
|
||||
}
|
||||
|
||||
// // ToFederator wraps a message that travels from the processor into the federator
|
||||
|
|
@ -23,7 +25,8 @@ type FromClientAPI struct {
|
|||
|
||||
// FromFederator wraps a message that travels from the federator into the processor
|
||||
type FromFederator struct {
|
||||
APObjectType ActivityStreamsObject
|
||||
APActivityType ActivityStreamsActivity
|
||||
GTSModel interface{}
|
||||
APObjectType string
|
||||
APActivityType string
|
||||
GTSModel interface{}
|
||||
ReceivingAccount *Account
|
||||
}
|
||||
|
|
|
|||
49
internal/gtsmodel/relationship.go
Normal file
49
internal/gtsmodel/relationship.go
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
GoToSocial
|
||||
Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
|
||||
|
||||
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 gtsmodel
|
||||
|
||||
// Relationship describes a requester's relationship with another account.
|
||||
type Relationship struct {
|
||||
// The account id.
|
||||
ID string
|
||||
// Are you following this user?
|
||||
Following bool
|
||||
// Are you receiving this user's boosts in your home timeline?
|
||||
ShowingReblogs bool
|
||||
// Have you enabled notifications for this user?
|
||||
Notifying bool
|
||||
// Are you followed by this user?
|
||||
FollowedBy bool
|
||||
// Are you blocking this user?
|
||||
Blocking bool
|
||||
// Is this user blocking you?
|
||||
BlockedBy bool
|
||||
// Are you muting this user?
|
||||
Muting bool
|
||||
// Are you muting notifications from this user?
|
||||
MutingNotifications bool
|
||||
// Do you have a pending follow request for this user?
|
||||
Requested bool
|
||||
// Are you blocking this user's domain?
|
||||
DomainBlocking bool
|
||||
// Are you featuring this user on your profile?
|
||||
Endorsed bool
|
||||
// Your note on this account.
|
||||
Note string
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ type Status struct {
|
|||
VisibilityAdvanced *VisibilityAdvanced
|
||||
// What is the activitystreams type of this status? See: https://www.w3.org/TR/activitystreams-vocabulary/#object-types
|
||||
// Will probably almost always be Note but who knows!.
|
||||
ActivityStreamsType ActivityStreamsObject
|
||||
ActivityStreamsType string
|
||||
// Original text of the status without formatting
|
||||
Text string
|
||||
// Has this status been pinned by its owner?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue