diff options
Diffstat (limited to 'internal/api')
-rw-r--r-- | internal/api/model/status.go | 30 | ||||
-rw-r--r-- | internal/api/s2s/webfinger/webfingerget_test.go | 4 |
2 files changed, 32 insertions, 2 deletions
diff --git a/internal/api/model/status.go b/internal/api/model/status.go index 3ff3f791d..fade58a49 100644 --- a/internal/api/model/status.go +++ b/internal/api/model/status.go @@ -96,6 +96,36 @@ type Status struct { Text string `json:"text"` } +/* +** The below functions are added onto the API model status so that it satisfies +** the Preparable interface in internal/timeline. + */ + +func (s *Status) GetID() string { + return s.ID +} + +func (s *Status) GetAccountID() string { + if s.Account != nil { + return s.Account.ID + } + return "" +} + +func (s *Status) GetBoostOfID() string { + if s.Reblog != nil { + return s.Reblog.ID + } + return "" +} + +func (s *Status) GetBoostOfAccountID() string { + if s.Reblog != nil && s.Reblog.Account != nil { + return s.Reblog.Account.ID + } + return "" +} + // StatusReblogged represents a reblogged status. // // swagger:model statusReblogged diff --git a/internal/api/s2s/webfinger/webfingerget_test.go b/internal/api/s2s/webfinger/webfingerget_test.go index 4b27ada42..d3b0c32e8 100644 --- a/internal/api/s2s/webfinger/webfingerget_test.go +++ b/internal/api/s2s/webfinger/webfingerget_test.go @@ -69,7 +69,7 @@ func (suite *WebfingerGetTestSuite) TestFingerUser() { func (suite *WebfingerGetTestSuite) TestFingerUserWithDifferentAccountDomainByHost() { viper.Set(config.Keys.Host, "gts.example.org") viper.Set(config.Keys.AccountDomain, "example.org") - suite.processor = processing.NewProcessor(suite.tc, suite.federator, testrig.NewTestOauthServer(suite.db), testrig.NewTestMediaHandler(suite.db, suite.storage), suite.storage, testrig.NewTestTimelineManager(suite.db), suite.db, suite.emailSender) + suite.processor = processing.NewProcessor(suite.tc, suite.federator, testrig.NewTestOauthServer(suite.db), testrig.NewTestMediaHandler(suite.db, suite.storage), suite.storage, suite.db, suite.emailSender) suite.webfingerModule = webfinger.New(suite.processor).(*webfinger.Module) targetAccount := accountDomainAccount() @@ -103,7 +103,7 @@ func (suite *WebfingerGetTestSuite) TestFingerUserWithDifferentAccountDomainByHo func (suite *WebfingerGetTestSuite) TestFingerUserWithDifferentAccountDomainByAccountDomain() { viper.Set(config.Keys.Host, "gts.example.org") viper.Set(config.Keys.AccountDomain, "example.org") - suite.processor = processing.NewProcessor(suite.tc, suite.federator, testrig.NewTestOauthServer(suite.db), testrig.NewTestMediaHandler(suite.db, suite.storage), suite.storage, testrig.NewTestTimelineManager(suite.db), suite.db, suite.emailSender) + suite.processor = processing.NewProcessor(suite.tc, suite.federator, testrig.NewTestOauthServer(suite.db), testrig.NewTestMediaHandler(suite.db, suite.storage), suite.storage, suite.db, suite.emailSender) suite.webfingerModule = webfinger.New(suite.processor).(*webfinger.Module) targetAccount := accountDomainAccount() |