diff options
author | 2021-05-17 19:06:58 +0200 | |
---|---|---|
committer | 2021-05-17 19:06:58 +0200 | |
commit | 6cd033449fd328410128bc3e840f4b8d3d74f052 (patch) | |
tree | 9868db8439533e078dea5bb34ae4949e9460f2cb /internal/message/statusprocess.go | |
parent | update progress (diff) | |
download | gotosocial-6cd033449fd328410128bc3e840f4b8d3d74f052.tar.xz |
Refine statuses (#26)
Remote media is now dereferenced and attached properly to incoming federated statuses.
Mentions are now dereferenced and attached properly to incoming federated statuses.
Small fixes to status visibility.
Allow URL params for filtering statuses:
// ExcludeRepliesKey is for specifying whether to exclude replies in a list of returned statuses by an account.
// PinnedKey is for specifying whether to include pinned statuses in a list of returned statuses by an account.
// MaxIDKey is for specifying the maximum ID of the status to retrieve.
// MediaOnlyKey is for specifying that only statuses with media should be returned in a list of returned statuses by an account.
Add endpoint for fetching an account's statuses.
Diffstat (limited to 'internal/message/statusprocess.go')
-rw-r--r-- | internal/message/statusprocess.go | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/internal/message/statusprocess.go b/internal/message/statusprocess.go index d9d115aec..86a07eb4f 100644 --- a/internal/message/statusprocess.go +++ b/internal/message/statusprocess.go @@ -1,3 +1,21 @@ +/* + 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 message import ( @@ -82,10 +100,10 @@ func (p *processor) StatusCreate(auth *oauth.Auth, form *apimodel.AdvancedStatus } // put the new status in the appropriate channel for async processing - p.fromClientAPI <- FromClientAPI{ + p.fromClientAPI <- gtsmodel.FromClientAPI{ APObjectType: newStatus.ActivityStreamsType, APActivityType: gtsmodel.ActivityStreamsCreate, - Activity: newStatus, + GTSModel: newStatus, } // return the frontend representation of the new status to the submitter @@ -161,8 +179,10 @@ func (p *processor) StatusFave(authed *oauth.Auth, targetStatusID string) (*apim } // is the status faveable? - if !targetStatus.VisibilityAdvanced.Likeable { - return nil, errors.New("status is not faveable") + if targetStatus.VisibilityAdvanced != nil { + if !targetStatus.VisibilityAdvanced.Likeable { + return nil, errors.New("status is not faveable") + } } // it's visible! it's faveable! so let's fave the FUCK out of it @@ -218,8 +238,10 @@ func (p *processor) StatusBoost(authed *oauth.Auth, targetStatusID string) (*api return nil, NewErrorNotFound(errors.New("status is not visible")) } - if !targetStatus.VisibilityAdvanced.Boostable { - return nil, NewErrorForbidden(errors.New("status is not boostable")) + if targetStatus.VisibilityAdvanced != nil { + if !targetStatus.VisibilityAdvanced.Boostable { + return nil, NewErrorForbidden(errors.New("status is not boostable")) + } } // it's visible! it's boostable! so let's boost the FUCK out of it @@ -428,8 +450,10 @@ func (p *processor) StatusUnfave(authed *oauth.Auth, targetStatusID string) (*ap } // is the status faveable? - if !targetStatus.VisibilityAdvanced.Likeable { - return nil, errors.New("status is not faveable") + if targetStatus.VisibilityAdvanced != nil { + if !targetStatus.VisibilityAdvanced.Likeable { + return nil, errors.New("status is not faveable") + } } // it's visible! it's faveable! so let's unfave the FUCK out of it |