rename actions package

This commit is contained in:
tobi 2025-01-07 17:44:38 +01:00
parent e773bba875
commit 175107f6a3
55 changed files with 116 additions and 116 deletions

View File

@ -32,7 +32,7 @@
"github.com/KimMachineGun/automemlimit/memlimit"
"github.com/gin-gonic/gin"
"github.com/superseriousbusiness/gotosocial/cmd/gotosocial/action"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api"
apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"
"github.com/superseriousbusiness/gotosocial/internal/cleaner"
@ -168,7 +168,7 @@
// Set Actions on state, providing workers to
// Actions as well for triggering side effects.
state.Actions = actions.New(dbService, &state.Workers)
state.AdminActions = admin.New(dbService, &state.Workers)
// Ensure necessary database instance prerequisites exist.
if err := dbService.CreateInstanceAccount(ctx); err != nil {

View File

@ -15,7 +15,7 @@
// 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 actions
package admin
import (
"context"

View File

@ -15,7 +15,7 @@
// 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 actions_test
package admin_test
import (
"context"
@ -75,7 +75,7 @@ func (suite *ActionsTestSuite) TestActionOverlap() {
key2 := action2.Key()
suite.Equal("account/01H90S1CXQ97J9625C5YBXZWGT", key2)
errWithCode := testStructs.State.Actions.Run(
errWithCode := testStructs.State.AdminActions.Run(
ctx,
action1,
func(ctx context.Context) gtserror.MultiError {
@ -88,7 +88,7 @@ func(ctx context.Context) gtserror.MultiError {
// While first action is sleeping, try to
// process another with the same key.
errWithCode = testStructs.State.Actions.Run(
errWithCode = testStructs.State.AdminActions.Run(
ctx,
action2,
func(ctx context.Context) gtserror.MultiError {
@ -104,13 +104,13 @@ func(ctx context.Context) gtserror.MultiError {
// Wait for action to finish.
if !testrig.WaitFor(func() bool {
return testStructs.State.Actions.TotalRunning() == 0
return testStructs.State.AdminActions.TotalRunning() == 0
}) {
suite.FailNow("timed out waiting for admin action(s) to finish")
}
// Try again.
errWithCode = testStructs.State.Actions.Run(
errWithCode = testStructs.State.AdminActions.Run(
ctx,
action2,
func(ctx context.Context) gtserror.MultiError {
@ -121,7 +121,7 @@ func(ctx context.Context) gtserror.MultiError {
// Wait for action to finish.
if !testrig.WaitFor(func() bool {
return testStructs.State.Actions.TotalRunning() == 0
return testStructs.State.AdminActions.TotalRunning() == 0
}) {
suite.FailNow("timed out waiting for admin action(s) to finish")
}
@ -143,7 +143,7 @@ func (suite *ActionsTestSuite) TestActionWithErrors() {
AccountID: "01H90S1ZZXP4N74H4A9RVW1MRP",
}
errWithCode := testStructs.State.Actions.Run(
errWithCode := testStructs.State.AdminActions.Run(
ctx,
action,
func(ctx context.Context) gtserror.MultiError {
@ -158,7 +158,7 @@ func(ctx context.Context) gtserror.MultiError {
// Wait for action to finish.
if !testrig.WaitFor(func() bool {
return testStructs.State.Actions.TotalRunning() == 0
return testStructs.State.AdminActions.TotalRunning() == 0
}) {
suite.FailNow("timed out waiting for admin action(s) to finish")
}

View File

@ -15,7 +15,7 @@
// 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 actions
package admin
import (
"context"

View File

@ -15,7 +15,7 @@
// 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 actions
package admin
import (
"context"

View File

@ -15,7 +15,7 @@
// 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 actions
package admin
import (
"context"

View File

@ -25,7 +25,7 @@
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/activitypub/emoji"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -74,7 +74,7 @@ func (suite *EmojiGetTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage
suite.tc = typeutils.NewConverter(&suite.state)

View File

@ -20,7 +20,7 @@
import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/activitypub/users"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -85,7 +85,7 @@ func (suite *UserStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.tc = typeutils.NewConverter(&suite.state)
testrig.StartTimelines(

View File

@ -26,7 +26,7 @@
"github.com/gin-contrib/sessions/memstore"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/auth"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -85,7 +85,7 @@ func (suite *AuthStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage
suite.mediaManager = testrig.NewTestMediaManager(&suite.state)

View File

@ -25,7 +25,7 @@
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/accounts"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -86,7 +86,7 @@ func (suite *AccountStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -25,7 +25,7 @@
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
adminactions "github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/admin"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -92,7 +92,7 @@ func (suite *AdminStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = adminactions.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -28,7 +28,7 @@
"testing"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/bookmarks"
"github.com/superseriousbusiness/gotosocial/internal/api/client/statuses"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
@ -96,7 +96,7 @@ func (suite *BookmarkTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/favourites"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -80,7 +80,7 @@ func (suite *FavouritesStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -23,7 +23,7 @@
"time"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
filtersV1 "github.com/superseriousbusiness/gotosocial/internal/api/client/filters/v1"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -91,7 +91,7 @@ func (suite *FiltersTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -23,7 +23,7 @@
"time"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
filtersV2 "github.com/superseriousbusiness/gotosocial/internal/api/client/filters/v2"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -91,7 +91,7 @@ func (suite *FiltersTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -21,7 +21,7 @@
"testing"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/followedtags"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -80,7 +80,7 @@ func (suite *FollowedTagsTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -24,7 +24,7 @@
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/followrequests"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -83,7 +83,7 @@ func (suite *FollowRequestStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -24,7 +24,7 @@
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/instance"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -85,7 +85,7 @@ func (suite *InstanceStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/lists"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -86,7 +86,7 @@ func (suite *ListsStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -25,7 +25,7 @@
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/mutes"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -82,7 +82,7 @@ func (suite *MutesTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/notifications"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -82,7 +82,7 @@ func (suite *NotificationsTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/polls"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -77,7 +77,7 @@ func (suite *PollsStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/reports"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -77,7 +77,7 @@ func (suite *ReportsStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -24,7 +24,7 @@
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/search"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -81,7 +81,7 @@ func (suite *SearchStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -25,7 +25,7 @@
"strings"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/statuses"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -193,7 +193,7 @@ func (suite *StatusStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -31,7 +31,7 @@
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/streaming"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -93,7 +93,7 @@ func (suite *StreamingTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -26,7 +26,7 @@
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/tags"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/config"
@ -88,7 +88,7 @@ func (suite *TagsTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -24,7 +24,7 @@
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/client/user"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/federation"
@ -73,7 +73,7 @@ func (suite *UserStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/fileserver"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -99,7 +99,7 @@ func (suite *FileserverTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
testrig.StandardDBSetup(suite.db, nil)
testrig.StandardStorageSetup(suite.storage, "../../../testrig/media")

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/api/wellknown/webfinger"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -80,7 +80,7 @@ func (suite *WebfingerStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.tc = typeutils.NewConverter(&suite.state)
testrig.StartTimelines(

View File

@ -26,7 +26,7 @@
"time"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/cleaner"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/filter/visibility"
@ -68,7 +68,7 @@ func (suite *MediaTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.storage = testrig.NewInMemoryStorage()
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.state.Storage = suite.storage
testrig.StandardStorageSetup(suite.storage, "../../testrig/media")

View File

@ -20,7 +20,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/federation/dereferencing"
"github.com/superseriousbusiness/gotosocial/internal/filter/interaction"
@ -78,7 +78,7 @@ func (suite *DereferencerStandardTestSuite) SetupTest() {
suite.client = testrig.NewMockHTTPClient(nil, "../../../testrig/media")
suite.storage = testrig.NewInMemoryStorage()
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.state.Storage = suite.storage
visFilter := visibility.NewFilter(&suite.state)

View File

@ -22,7 +22,7 @@
"time"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/federation/federatingdb"
"github.com/superseriousbusiness/gotosocial/internal/filter/visibility"
@ -92,7 +92,7 @@ func (suite *FederatingDBTestSuite) SetupTest() {
testrig.StandardDBSetup(suite.db, suite.testAccounts)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
}
func (suite *FederatingDBTestSuite) TearDownTest() {

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/filter/visibility"
gtsmodel "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
@ -54,7 +54,7 @@ func (suite *MediaStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.storage = testrig.NewInMemoryStorage()
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.state.Storage = suite.storage
testrig.StandardStorageSetup(suite.storage, "../../testrig/media")

View File

@ -22,7 +22,7 @@
"testing"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/oauth"
"github.com/superseriousbusiness/gotosocial/internal/state"
@ -55,7 +55,7 @@ func (suite *PgClientStoreTestSuite) SetupTest() {
testrig.InitTestConfig()
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
testrig.StandardDBSetup(suite.db, nil)
}

View File

@ -22,7 +22,7 @@
"time"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
"github.com/superseriousbusiness/gotosocial/internal/federation"
@ -94,7 +94,7 @@ func (suite *AccountStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.tc = typeutils.NewConverter(&suite.state)
testrig.StartTimelines(

View File

@ -53,7 +53,7 @@ func (suite *AccountTestSuite) TestAccountActionSuspend() {
// Wait for action to finish.
if !testrig.WaitFor(func() bool {
return suite.state.Actions.TotalRunning() == 0
return suite.state.AdminActions.TotalRunning() == 0
}) {
suite.FailNow("timed out waiting for admin action(s) to finish")
}

View File

@ -68,7 +68,7 @@ func (p *Processor) accountActionSuspend(
) (string, gtserror.WithCode) {
actionID := id.NewULID()
errWithCode := p.state.Actions.Run(
errWithCode := p.state.AdminActions.Run(
ctx,
&gtsmodel.AdminAction{
ID: actionID,

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
adminactions "github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/cleaner"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -91,7 +91,7 @@ func (suite *AdminStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = adminactions.New(suite.state.DB, &suite.state.Workers)
suite.tc = typeutils.NewConverter(&suite.state)
testrig.StartTimelines(

View File

@ -76,10 +76,10 @@ func (p *Processor) createDomainAllow(
AccountID: adminAcct.ID,
}
if errWithCode := p.state.Actions.Run(
if errWithCode := p.state.AdminActions.Run(
ctx,
action,
p.state.Actions.DomainAllowF(action.ID, domainAllow),
p.state.AdminActions.DomainAllowF(action.ID, domainAllow),
); errWithCode != nil {
return nil, action.ID, errWithCode
}
@ -132,10 +132,10 @@ func (p *Processor) deleteDomainAllow(
AccountID: adminAcct.ID,
}
if errWithCode := p.state.Actions.Run(
if errWithCode := p.state.AdminActions.Run(
ctx,
action,
p.state.Actions.DomainUnallowF(action.ID, domainAllow),
p.state.AdminActions.DomainUnallowF(action.ID, domainAllow),
); errWithCode != nil {
return nil, action.ID, errWithCode
}

View File

@ -77,10 +77,10 @@ func (p *Processor) createDomainBlock(
Text: domainBlock.PrivateComment,
}
if errWithCode := p.state.Actions.Run(
if errWithCode := p.state.AdminActions.Run(
ctx,
action,
p.state.Actions.DomainBlockF(action.ID, domainBlock),
p.state.AdminActions.DomainBlockF(action.ID, domainBlock),
); errWithCode != nil {
return nil, action.ID, errWithCode
}
@ -133,10 +133,10 @@ func (p *Processor) deleteDomainBlock(
AccountID: adminAcct.ID,
}
if errWithCode := p.state.Actions.Run(
if errWithCode := p.state.AdminActions.Run(
ctx,
action,
p.state.Actions.DomainUnblockF(action.ID, domainBlock),
p.state.AdminActions.DomainUnblockF(action.ID, domainBlock),
); errWithCode != nil {
return nil, action.ID, errWithCode
}

View File

@ -48,10 +48,10 @@ func (p *Processor) DomainKeysExpire(
AccountID: adminAcct.ID,
}
if errWithCode := p.state.Actions.Run(
if errWithCode := p.state.AdminActions.Run(
ctx,
action,
p.state.Actions.DomainKeysExpireF(domain),
p.state.AdminActions.DomainKeysExpireF(domain),
); errWithCode != nil {
return action.ID, errWithCode
}

View File

@ -186,7 +186,7 @@ func (suite *DomainBlockTestSuite) awaitAction(actionID string) {
ctx := context.Background()
if !testrig.WaitFor(func() bool {
return suite.state.Actions.TotalRunning() == 0
return suite.state.AdminActions.TotalRunning() == 0
}) {
suite.FailNow("timed out waiting for admin action(s) to finish")
}

View File

@ -23,7 +23,7 @@
"time"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
dbtest "github.com/superseriousbusiness/gotosocial/internal/db/test"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -104,7 +104,7 @@ func (suite *ConversationsTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.tc = typeutils.NewConverter(&suite.state)
suite.filter = visibility.NewFilter(&suite.state)

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/filter/visibility"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
@ -76,7 +76,7 @@ func (suite *MediaStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.tc = typeutils.NewConverter(&suite.state)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -21,7 +21,7 @@
"context"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/cleaner"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
@ -104,7 +104,7 @@ func (suite *ProcessingStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.testActivities = testrig.NewTestActivities(suite.testAccounts)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/federation"
"github.com/superseriousbusiness/gotosocial/internal/filter/interaction"
@ -85,7 +85,7 @@ func (suite *StatusStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.typeConverter = typeutils.NewConverter(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.tc = testrig.NewTestTransportController(&suite.state, testrig.NewMockHTTPClient(nil, "../../../testrig/media"))
suite.storage = testrig.NewInMemoryStorage()

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/oauth"
@ -51,7 +51,7 @@ func (suite *StreamTestSuite) SetupTest() {
suite.testTokens = testrig.NewTestTokens()
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.oauthServer = testrig.NewTestOauthServer(suite.db)
suite.streamProcessor = stream.New(&suite.state, suite.oauthServer)

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/filter/visibility"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
@ -56,7 +56,7 @@ func (suite *TimelineStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.timeline = timeline.New(
&suite.state,

View File

@ -19,7 +19,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
@ -50,7 +50,7 @@ func (suite *UserStandardTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.sentEmails = make(map[string]string)
suite.emailSender = testrig.NewEmailSender("../../../web/template/", suite.sentEmails)

View File

@ -19,7 +19,7 @@
import (
"codeberg.org/gruf/go-mutexes"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/cache"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/storage"
@ -68,7 +68,7 @@ type State struct {
// Struct to manage running admin
// actions (and locks thereupon).
Actions *actions.Actions
AdminActions *admin.Actions
// prevent pass-by-value.
_ nocopy

View File

@ -32,7 +32,7 @@
"codeberg.org/gruf/go-kv"
"github.com/miekg/dns"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
@ -434,7 +434,7 @@ func (s *Subscriptions) processDomainPermission(
var (
insertF func() error
action *gtsmodel.AdminAction
actionF actions.AdminActionF
actionF admin.AdminActionF
)
if permSub.PermissionType == gtsmodel.DomainPermissionBlock {
@ -458,7 +458,7 @@ func (s *Subscriptions) processDomainPermission(
Type: gtsmodel.AdminActionSuspend,
AccountID: permSub.CreatedByAccountID,
}
actionF = s.state.Actions.DomainBlockF(action.ID, domainBlock)
actionF = s.state.AdminActions.DomainBlockF(action.ID, domainBlock)
} else {
// Prepare to insert + process an allow.
@ -481,7 +481,7 @@ func (s *Subscriptions) processDomainPermission(
Type: gtsmodel.AdminActionUnsuspend,
AccountID: permSub.CreatedByAccountID,
}
actionF = s.state.Actions.DomainAllowF(action.ID, domainAllow)
actionF = s.state.AdminActions.DomainAllowF(action.ID, domainAllow)
}
// Insert the new perm in the db.
@ -493,7 +493,7 @@ func (s *Subscriptions) processDomainPermission(
// Run admin action to process
// side effects of permission.
err = s.state.Actions.Run(ctx, action, actionF)
err = s.state.AdminActions.Run(ctx, action, actionF)
case existingPerm.GetSubscriptionID() != "" || *permSub.AdoptOrphans:
// Perm exists but we should adopt/take

View File

@ -21,7 +21,7 @@
"context"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email"
"github.com/superseriousbusiness/gotosocial/internal/federation"
@ -75,7 +75,7 @@ func (suite *TransportTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
suite.storage = testrig.NewInMemoryStorage()
suite.state.Storage = suite.storage

View File

@ -20,7 +20,7 @@
import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/filter/visibility"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
@ -500,7 +500,7 @@ func (suite *TypeUtilsTestSuite) SetupTest() {
suite.db = testrig.NewTestDB(&suite.state)
suite.state.DB = suite.db
suite.state.Actions = actions.New(suite.state.DB, &suite.state.Workers)
suite.state.AdminActions = admin.New(suite.state.DB, &suite.state.Workers)
storage := testrig.NewInMemoryStorage()
suite.state.Storage = storage

View File

@ -18,7 +18,7 @@
package testrig
import (
"github.com/superseriousbusiness/gotosocial/internal/actions"
"github.com/superseriousbusiness/gotosocial/internal/admin"
"github.com/superseriousbusiness/gotosocial/internal/cleaner"
"github.com/superseriousbusiness/gotosocial/internal/email"
"github.com/superseriousbusiness/gotosocial/internal/filter/interaction"
@ -60,7 +60,7 @@ func SetupTestStructs(
db := NewTestDB(&state)
state.DB = db
state.Actions = actions.New(db, &state.Workers)
state.AdminActions = admin.New(db, &state.Workers)
storage := NewInMemoryStorage()
state.Storage = storage