Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Bring "commercial" to life

Matt Roberts84e585b57c7b
diff --git a/.test.env b/.test.env
index f5d61a25f..96821ae4f 100644
--- a/.test.env
+++ b/.test.env
@@ -40,3 +40,5 @@ EMAIL_MAILGUN_DOMAIN=mydomain.com
USER_LIST_ENABLED=true
USER_LIST_APIKEY=abcdefg
+
+COMMERCIAL_ENABLED=true
diff --git a/Makefile b/Makefile
index 2be0e4d7a..764ec32e4 100644
--- a/Makefile
+++ b/Makefile
@@ -38,16 +38,16 @@ build-ssr: ## Build SSR script and locales
test: test-server test-ui ## Test server and ui code
-test-server: build-server build-ssr ## Run all server tests
+test-server: build-server build-ssr ## Run all server tests (set SHORT=false for full tests including network-dependent tests)
godotenv -f .test.env ./fider migrate
- godotenv -f .test.env go test ./... -race
+ godotenv -f .test.env go test ./... -race $(if $(filter false,$(SHORT)),,-short)
test-ui: ## Run all UI tests
TZ=GMT npx jest ./public
-coverage-server: build-server build-ssr ## Run all server tests (with code coverage)
+coverage-server: build-server build-ssr ## Run all server tests (with code coverage, set SHORT=false for full tests)
godotenv -f .test.env ./fider migrate
- godotenv -f .test.env go test ./... -coverprofile=cover.out -coverpkg=all -p=8 -race
+ godotenv -f .test.env go test ./... -coverprofile=cover.out -coverpkg=all -p=8 -race $(if $(filter false,$(SHORT)),,-short)
diff --git a/app/handlers/apiv1/moderation_test.go b/app/handlers/apiv1/moderation_test.go
deleted file mode 100644
index 3f4c7238d..000000000
--- a/app/handlers/apiv1/moderation_test.go
+++ /dev/null
@@ -1,677 +0,0 @@
-package apiv1_test
-
-import (
- "context"
- "net/http"
- "testing"
-
- "github.com/getfider/fider/app"
- "github.com/getfider/fider/app/handlers/apiv1"
- "github.com/getfider/fider/app/models/cmd"
- "github.com/getfider/fider/app/models/entity"
- "github.com/getfider/fider/app/models/query"
- . "github.com/getfider/fider/app/pkg/assert"
- "github.com/getfider/fider/app/pkg/bus"
- "github.com/getfider/fider/app/pkg/mock"
-)
-
-func TestApprovePost_Success(t *testing.T) {
- RegisterT(t)
-
- var approvePost *cmd.ApprovePost
- bus.AddHandler(func(ctx context.Context, c *cmd.ApprovePost) error {
- approvePost = c
- return nil
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "5").
- ExecutePost(apiv1.ApprovePost(), `{}`)
-
- Expect(code).Equals(http.StatusOK)
- Expect(approvePost.PostID).Equals(5)
-}
-
-func TestApprovePost_InvalidID(t *testing.T) {
- RegisterT(t)
-
- code, response := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "invalid").
- ExecuteAsJSON(apiv1.ApprovePost())
-
- Expect(code).Equals(http.StatusBadRequest)
- Expect(response.String("error")).Equals("Invalid post ID")
-}
-
-func TestApprovePost_CommandFailure(t *testing.T) {
- RegisterT(t)
-
- bus.AddHandler(func(ctx context.Context, c *cmd.ApprovePost) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "5").
- ExecutePost(apiv1.ApprovePost(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestDeclinePost_Success(t *testing.T) {
- RegisterT(t)
-
- var declinePost *cmd.DeclinePost
- bus.AddHandler(func(ctx context.Context, c *cmd.DeclinePost) error {
- declinePost = c
- return nil
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "10").
- ExecutePost(apiv1.DeclinePost(), `{}`)
-
- Expect(code).Equals(http.StatusOK)
- Expect(declinePost.PostID).Equals(10)
-}
-
-func TestDeclinePost_InvalidID(t *testing.T) {
- RegisterT(t)
-
- code, response := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "abc").
- ExecuteAsJSON(apiv1.DeclinePost())
-
- Expect(code).Equals(http.StatusBadRequest)
- Expect(response.String("error")).Equals("Invalid post ID")
-}
-
-func TestDeclinePost_CommandFailure(t *testing.T) {
- RegisterT(t)
-
- bus.AddHandler(func(ctx context.Context, c *cmd.DeclinePost) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "10").
- ExecutePost(apiv1.DeclinePost(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestApproveComment_Success(t *testing.T) {
- RegisterT(t)
-
- var approveComment *cmd.ApproveComment
- bus.AddHandler(func(ctx context.Context, c *cmd.ApproveComment) error {
- approveComment = c
- return nil
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "15").
- ExecutePost(apiv1.ApproveComment(), `{}`)
-
- Expect(code).Equals(http.StatusOK)
- Expect(approveComment.CommentID).Equals(15)
-}
-
-func TestApproveComment_InvalidID(t *testing.T) {
- RegisterT(t)
-
- code, response := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "not-a-number").
- ExecuteAsJSON(apiv1.ApproveComment())
-
- Expect(code).Equals(http.StatusBadRequest)
- Expect(response.String("error")).Equals("Invalid comment ID")
-}
-
-func TestApproveComment_CommandFailure(t *testing.T) {
- RegisterT(t)
-
- bus.AddHandler(func(ctx context.Context, c *cmd.ApproveComment) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "15").
- ExecutePost(apiv1.ApproveComment(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestDeclineComment_Success(t *testing.T) {
- RegisterT(t)
-
- var declineComment *cmd.DeclineComment
- bus.AddHandler(func(ctx context.Context, c *cmd.DeclineComment) error {
- declineComment = c
- return nil
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "20").
- ExecutePost(apiv1.DeclineComment(), `{}`)
-
- Expect(code).Equals(http.StatusOK)
- Expect(declineComment.CommentID).Equals(20)
-}
-
-func TestDeclineComment_InvalidID(t *testing.T) {
- RegisterT(t)
-
- code, response := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "").
- ExecuteAsJSON(apiv1.DeclineComment())
-
- Expect(code).Equals(http.StatusBadRequest)
- Expect(response.String("error")).Equals("Invalid comment ID")
-}
-
-func TestDeclineComment_CommandFailure(t *testing.T) {
- RegisterT(t)
-
- bus.AddHandler(func(ctx context.Context, c *cmd.DeclineComment) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "20").
- ExecutePost(apiv1.DeclineComment(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestDeclinePostAndBlock_Success(t *testing.T) {
- RegisterT(t)
-
- post := &entity.Post{
- ID: 1,
- Number: 5,
- Title: "Test Post",
- User: mock.AryaStark,
- }
-
- bus.AddHandler(func(ctx context.Context, q *query.GetPostByID) error {
- if q.PostID == 5 {
- q.Result = post
- return nil
- }
- return app.ErrNotFound
- })
-
- var blockUser *cmd.BlockUser
- bus.AddHandler(func(ctx context.Context, c *cmd.BlockUser) error {
- blockUser = c
- return nil
- })
-
- var declinePost *cmd.DeclinePost
- bus.AddHandler(func(ctx context.Context, c *cmd.DeclinePost) error {
- declinePost = c
- return nil
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "5").
- ExecutePost(apiv1.DeclinePostAndBlock(), `{}`)
-
- Expect(code).Equals(http.StatusOK)
- Expect(blockUser.UserID).Equals(mock.AryaStark.ID)
- Expect(declinePost.PostID).Equals(5)
-}
-
-func TestDeclinePostAndBlock_InvalidID(t *testing.T) {
- RegisterT(t)
-
- code, response := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "invalid").
- ExecuteAsJSON(apiv1.DeclinePostAndBlock())
-
- Expect(code).Equals(http.StatusBadRequest)
- Expect(response.String("error")).Equals("Invalid post ID")
-}
-
-func TestDeclinePostAndBlock_PostNotFound(t *testing.T) {
- RegisterT(t)
-
- bus.AddHandler(func(ctx context.Context, q *query.GetPostByID) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "999").
- ExecutePost(apiv1.DeclinePostAndBlock(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestDeclinePostAndBlock_BlockUserFailure(t *testing.T) {
- RegisterT(t)
-
- post := &entity.Post{
- ID: 1,
- Number: 5,
- Title: "Test Post",
- User: mock.AryaStark,
- }
-
- bus.AddHandler(func(ctx context.Context, q *query.GetPostByID) error {
- if q.PostID == 5 {
- q.Result = post
- return nil
- }
- return app.ErrNotFound
- })
-
- bus.AddHandler(func(ctx context.Context, c *cmd.BlockUser) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "5").
- ExecutePost(apiv1.DeclinePostAndBlock(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestDeclineCommentAndBlock_Success(t *testing.T) {
- RegisterT(t)
-
- comment := &entity.Comment{
- ID: 25,
- Content: "Test Comment",
- User: mock.AryaStark,
- }
-
- bus.AddHandler(func(ctx context.Context, q *query.GetCommentByID) error {
- if q.CommentID == 25 {
- q.Result = comment
- return nil
- }
- return app.ErrNotFound
- })
-
- var blockUser *cmd.BlockUser
- bus.AddHandler(func(ctx context.Context, c *cmd.BlockUser) error {
- blockUser = c
- return nil
- })
-
- var declineComment *cmd.DeclineComment
- bus.AddHandler(func(ctx context.Context, c *cmd.DeclineComment) error {
- declineComment = c
- return nil
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "25").
- ExecutePost(apiv1.DeclineCommentAndBlock(), `{}`)
-
- Expect(code).Equals(http.StatusOK)
- Expect(blockUser.UserID).Equals(mock.AryaStark.ID)
- Expect(declineComment.CommentID).Equals(25)
-}
-
-func TestDeclineCommentAndBlock_InvalidID(t *testing.T) {
- RegisterT(t)
-
- code, response := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "xyz").
- ExecuteAsJSON(apiv1.DeclineCommentAndBlock())
-
- Expect(code).Equals(http.StatusBadRequest)
- Expect(response.String("error")).Equals("Invalid comment ID")
-}
-
-func TestDeclineCommentAndBlock_CommentNotFound(t *testing.T) {
- RegisterT(t)
-
- bus.AddHandler(func(ctx context.Context, q *query.GetCommentByID) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "999").
- ExecutePost(apiv1.DeclineCommentAndBlock(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestDeclineCommentAndBlock_BlockUserFailure(t *testing.T) {
- RegisterT(t)
-
- comment := &entity.Comment{
- ID: 25,
- Content: "Test Comment",
- User: mock.AryaStark,
- }
-
- bus.AddHandler(func(ctx context.Context, q *query.GetCommentByID) error {
- if q.CommentID == 25 {
- q.Result = comment
- return nil
- }
- return app.ErrNotFound
- })
-
- bus.AddHandler(func(ctx context.Context, c *cmd.BlockUser) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "25").
- ExecutePost(apiv1.DeclineCommentAndBlock(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestApprovePostAndVerify_Success(t *testing.T) {
- RegisterT(t)
-
- post := &entity.Post{
- ID: 1,
- Number: 5,
- Title: "Test Post",
- User: mock.AryaStark,
- }
-
- bus.AddHandler(func(ctx context.Context, q *query.GetPostByID) error {
- if q.PostID == 5 {
- q.Result = post
- return nil
- }
- return app.ErrNotFound
- })
-
- var approvePost *cmd.ApprovePost
- bus.AddHandler(func(ctx context.Context, c *cmd.ApprovePost) error {
- approvePost = c
- return nil
- })
-
- var verifyUser *cmd.VerifyUser
- bus.AddHandler(func(ctx context.Context, c *cmd.VerifyUser) error {
- verifyUser = c
- return nil
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "5").
- ExecutePost(apiv1.ApprovePostAndVerify(), `{}`)
-
- Expect(code).Equals(http.StatusOK)
- Expect(approvePost.PostID).Equals(5)
- Expect(verifyUser.UserID).Equals(mock.AryaStark.ID)
-}
-
-func TestApprovePostAndVerify_InvalidID(t *testing.T) {
- RegisterT(t)
-
- code, response := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "invalid").
- ExecuteAsJSON(apiv1.ApprovePostAndVerify())
-
- Expect(code).Equals(http.StatusBadRequest)
- Expect(response.String("error")).Equals("Invalid post ID")
-}
-
-func TestApprovePostAndVerify_PostNotFound(t *testing.T) {
- RegisterT(t)
-
- bus.AddHandler(func(ctx context.Context, q *query.GetPostByID) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "999").
- ExecutePost(apiv1.ApprovePostAndVerify(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestApprovePostAndVerify_ApproveFailure(t *testing.T) {
- RegisterT(t)
-
- post := &entity.Post{
- ID: 1,
- Number: 5,
- Title: "Test Post",
- User: mock.AryaStark,
- }
-
- bus.AddHandler(func(ctx context.Context, q *query.GetPostByID) error {
- if q.PostID == 5 {
- q.Result = post
- return nil
- }
- return app.ErrNotFound
- })
-
- bus.AddHandler(func(ctx context.Context, c *cmd.ApprovePost) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "5").
- ExecutePost(apiv1.ApprovePostAndVerify(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestApprovePostAndVerify_VerifyUserFailure(t *testing.T) {
- RegisterT(t)
-
- post := &entity.Post{
- ID: 1,
- Number: 5,
- Title: "Test Post",
- User: mock.AryaStark,
- }
-
- bus.AddHandler(func(ctx context.Context, q *query.GetPostByID) error {
- if q.PostID == 5 {
- q.Result = post
- return nil
- }
- return app.ErrNotFound
- })
-
- bus.AddHandler(func(ctx context.Context, c *cmd.ApprovePost) error {
- return nil
- })
-
- bus.AddHandler(func(ctx context.Context, c *cmd.VerifyUser) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "5").
- ExecutePost(apiv1.ApprovePostAndVerify(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestApproveCommentAndVerify_Success(t *testing.T) {
- RegisterT(t)
-
- comment := &entity.Comment{
- ID: 25,
- Content: "Test Comment",
- User: mock.AryaStark,
- }
-
- bus.AddHandler(func(ctx context.Context, q *query.GetCommentByID) error {
- if q.CommentID == 25 {
- q.Result = comment
- return nil
- }
- return app.ErrNotFound
- })
-
- var approveComment *cmd.ApproveComment
- bus.AddHandler(func(ctx context.Context, c *cmd.ApproveComment) error {
- approveComment = c
- return nil
- })
-
- var verifyUser *cmd.VerifyUser
- bus.AddHandler(func(ctx context.Context, c *cmd.VerifyUser) error {
- verifyUser = c
- return nil
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "25").
- ExecutePost(apiv1.ApproveCommentAndVerify(), `{}`)
-
- Expect(code).Equals(http.StatusOK)
- Expect(approveComment.CommentID).Equals(25)
- Expect(verifyUser.UserID).Equals(mock.AryaStark.ID)
-}
-
-func TestApproveCommentAndVerify_InvalidID(t *testing.T) {
- RegisterT(t)
-
- code, response := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "invalid").
- ExecuteAsJSON(apiv1.ApproveCommentAndVerify())
-
- Expect(code).Equals(http.StatusBadRequest)
- Expect(response.String("error")).Equals("Invalid comment ID")
-}
-
-func TestApproveCommentAndVerify_CommentNotFound(t *testing.T) {
- RegisterT(t)
-
- bus.AddHandler(func(ctx context.Context, q *query.GetCommentByID) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "999").
- ExecutePost(apiv1.ApproveCommentAndVerify(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestApproveCommentAndVerify_ApproveFailure(t *testing.T) {
- RegisterT(t)
-
- comment := &entity.Comment{
- ID: 25,
- Content: "Test Comment",
- User: mock.AryaStark,
- }
-
- bus.AddHandler(func(ctx context.Context, q *query.GetCommentByID) error {
- if q.CommentID == 25 {
- q.Result = comment
- return nil
- }
- return app.ErrNotFound
- })
-
- bus.AddHandler(func(ctx context.Context, c *cmd.ApproveComment) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "25").
- ExecutePost(apiv1.ApproveCommentAndVerify(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
-
-func TestApproveCommentAndVerify_VerifyUserFailure(t *testing.T) {
- RegisterT(t)
-
- comment := &entity.Comment{
- ID: 25,
- Content: "Test Comment",
- User: mock.AryaStark,
- }
-
- bus.AddHandler(func(ctx context.Context, q *query.GetCommentByID) error {
- if q.CommentID == 25 {
- q.Result = comment
- return nil
- }
- return app.ErrNotFound
- })
-
- bus.AddHandler(func(ctx context.Context, c *cmd.ApproveComment) error {
- return nil
- })
-
- bus.AddHandler(func(ctx context.Context, c *cmd.VerifyUser) error {
- return app.ErrNotFound
- })
-
- code, _ := mock.NewServer().
- OnTenant(mock.DemoTenant).
- AsUser(mock.JonSnow).
- AddParam("id", "25").
- ExecutePost(apiv1.ApproveCommentAndVerify(), `{}`)
-
- Expect(code).Equals(http.StatusNotFound)
-}
diff --git a/app/pkg/dbx/mapping.go b/app/pkg/dbx/mapping.go
index be484bd8b..1b484b66b 100644
--- a/app/pkg/dbx/mapping.go
+++ b/app/pkg/dbx/mapping.go
@@ -1,6 +1,7 @@
package dbx
import (
+ "database/sql"
"fmt"
"reflect"
"sync"
@@ -63,7 +64,11 @@ func (m *RowMapper) Map(dest any, columns []string, scanner func(dest ...any) er
panic(fmt.Sprintf("Field not found for column %s", c))
}
- if field.Kind() == reflect.Slice && field.Type().Elem().Kind() != reflect.Uint8 {
+ // Check if the field type implements sql.Scanner
+ scannerType := reflect.TypeOf((*sql.Scanner)(nil)).Elem()
+ implementsScanner := field.Addr().Type().Implements(scannerType)
+
+ if field.Kind() == reflect.Slice && field.Type().Elem().Kind() != reflect.Uint8 && !implementsScanner {
obj := reflect.New(reflect.MakeSlice(field.Type(), 0, 0).Type()).Elem()
field.Set(obj)
pointers[i] = pq.Array(field.Addr().Interface())
diff --git a/app/pkg/dbx/setup.sql b/app/pkg/dbx/setup.sql
index 71a21eeb8..0f7fa69b2 100644
--- a/app/pkg/dbx/setup.sql
+++ b/app/pkg/dbx/setup.sql
@@ -2,43 +2,41 @@ TRUNCATE TABLE blobs RESTART IDENTITY CASCADE;
TRUNCATE TABLE logs RESTART IDENTITY CASCADE;
TRUNCATE TABLE tenants RESTART IDENTITY CASCADE;
-INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing)
-VALUES ('Demonstration', 'demo', now(), '', '', '', 1, false, '', '', 'en', true, true, false);
+INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing, is_moderation_enabled)
+VALUES ('Demonstration', 'demo', now(), '', '', '', 1, false, '', '', 'en', true, true, false, false);
-INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
+INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
VALUES ('Jon Snow', '[email protected]', 1, now(), 3, 1, 2, '');
-INSERT INTO user_providers (user_id, tenant_id, provider, provider_uid, created_at)
+INSERT INTO user_providers (user_id, tenant_id, provider, provider_uid, created_at)
VALUES (1, 1, 'facebook', 'FB1234', now());
-INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
+INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
VALUES ('Arya Stark', '[email protected]', 1, now(), 1, 1, 2, '');
-INSERT INTO user_providers (user_id, tenant_id, provider, provider_uid, created_at)
+INSERT INTO user_providers (user_id, tenant_id, provider, provider_uid, created_at)
VALUES (2, 1, 'google', 'GO5678', now());
-INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
+INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
VALUES ('Sansa Stark', '[email protected]', 1, now(), 1, 1, 2, '');
-INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing)
-VALUES ('Avengers', 'avengers', now(), 'feedback.avengers.com', '', '', 1, false, '', '', 'en', true, true, false);
+INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing, is_moderation_enabled)
+VALUES ('Avengers', 'avengers', now(), 'feedback.avengers.com', '', '', 1, false, '', '', 'en', true, true, false, false);
-INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
+INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
VALUES ('Tony Stark', '[email protected]', 2, now(), 3, 1, 2, '');
-INSERT INTO user_providers (user_id, tenant_id, provider, provider_uid, created_at)
+INSERT INTO user_providers (user_id, tenant_id, provider, provider_uid, created_at)
VALUES (4, 2, 'facebook', 'FB2222', now());
-INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
+INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
VALUES ('The Hulk', '[email protected]', 2, now(), 1, 1, 2, '');
-INSERT INTO user_providers (user_id, tenant_id, provider, provider_uid, created_at)
+INSERT INTO user_providers (user_id, tenant_id, provider, provider_uid, created_at)
VALUES (5, 2, 'google', 'GO1111', now());
-- Create a tenant that has reached the end of it's trial period
-INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing)
-VALUES ('Trial Expired', 'trial-expired', now(), 'feedback.trial-expired.com', '', '', 1, false, '', '', 'en', true, true, false);
+INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing, is_moderation_enabled )
+VALUES ('Trial Expired', 'trial-expired', now(), 'feedback.trial-expired.com', '', '', 1, false, '', '', 'en', true, true, false, false);
INSERT INTO tenants_billing (tenant_id, paddle_plan_id, paddle_subscription_id, status, subscription_ends_at, trial_ends_at)
VALUES (3, 1, 1,1, now(), CURRENT_DATE - INTERVAL '10 days');
INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)
VALUES ('Trial Expired', '[email protected]', 3, now(), 3, 1, 2, '');
INSERT INTO user_providers (user_id, tenant_id, provider, provider_uid, created_at)
VALUES (6, 3, 'facebook', 'FB3333', now());
-
-
diff --git a/app/pkg/web/ssl_test.go b/app/pkg/web/ssl_test.go
index e16fe1f8f..a4328a18b 100644
--- a/app/pkg/web/ssl_test.go
+++ b/app/pkg/web/ssl_test.go
@@ -39,6 +39,9 @@ func mockGetTenantWithIncorrectSubdomains(ctx context.Context, q *query.GetTenan
}
func TestUseAutoCert_WhenCNAMEAreRegistered(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping test that requires real DNS lookups and ACME requests")
+ }
RegisterT(t)
bus.Init(fs.Service{})
bus.AddHandler(mockGetTenantWithCorrectSubdomains)
@@ -112,6 +115,9 @@ func TestGetCertificate_WhenCNAMEAreNotConfigured(t *testing.T) {
}
func TestGetCertificate_WhenCNAMEDoesntMatch(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping test that requires real DNS lookups")
+ }
RegisterT(t)
bus.Init(fs.Service{})
diff --git a/app/pkg/web/testdata/basic.html b/app/pkg/web/testdata/basic.html
index 4f7cd1fd1..4aad10313 100755
--- a/app/pkg/web/testdata/basic.html
+++ b/app/pkg/web/testdata/basic.html
@@ -45,7 +45,7 @@
<script id="server-data" type="application/json">
- {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":null,"title":"Fider"}
+ {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"isCommercialEnabled":true,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":null,"title":"Fider"}
</script>
diff --git a/app/pkg/web/testdata/canonical.html b/app/pkg/web/testdata/canonical.html
index f6334b1e2..efc0c62f9 100755
--- a/app/pkg/web/testdata/canonical.html
+++ b/app/pkg/web/testdata/canonical.html
@@ -47,7 +47,7 @@
<script id="server-data" type="application/json">
- {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":null,"title":"Fider"}
+ {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"isCommercialEnabled":true,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":null,"title":"Fider"}
</script>
diff --git a/app/pkg/web/testdata/chunk.html b/app/pkg/web/testdata/chunk.html
index dfdf17bc3..a161c9131 100644
--- a/app/pkg/web/testdata/chunk.html
+++ b/app/pkg/web/testdata/chunk.html
@@ -45,7 +45,7 @@
<script id="server-data" type="application/json">
- {"contextID":"CONTEXT_ID","page":"Test.page","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":null,"title":"Fider"}
+ {"contextID":"CONTEXT_ID","page":"Test.page","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"isCommercialEnabled":true,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":null,"title":"Fider"}
</script>
diff --git a/app/pkg/web/testdata/home.html b/app/pkg/web/testdata/home.html
index 3297e64d6..dbea062ad 100755
--- a/app/pkg/web/testdata/home.html
+++ b/app/pkg/web/testdata/home.html
@@ -45,7 +45,7 @@
<script id="server-data" type="application/json">
- {"contextID":"CONTEXT_ID","description":"My Page Description","page":"","props":{"countPerStatus":{},"posts":[],"tags":[]},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":null,"title":"My Page Title · Fider"}
+ {"contextID":"CONTEXT_ID","description":"My Page Description","page":"","props":{"countPerStatus":{},"posts":[],"tags":[]},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"isCommercialEnabled":true,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":null,"title":"My Page Title · Fider"}
</script>
diff --git a/app/pkg/web/testdata/home_ssr.html b/app/pkg/web/testdata/home_ssr.html
index 32c2823bf..d4f6ae8e0 100755
--- a/app/pkg/web/testdata/home_ssr.html
+++ b/app/pkg/web/testdata/home_ssr.html
@@ -45,7 +45,7 @@
<script id="server-data" type="application/json">
- {"contextID":"CONTEXT_ID","description":"My Page Description","page":"Test.page","props":{"countPerStatus":{},"posts":[],"tags":[]},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"locale":"en","isPrivate":false,"logoBlobKey":"","allowedSchemes":"","isEmailAuthAllowed":false,"isFeedEnabled":false,"preventIndexing":false},"title":"My Page Title · "}
+ {"contextID":"CONTEXT_ID","description":"My Page Description","page":"Test.page","props":{"countPerStatus":{},"posts":[],"tags":[]},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"isCommercialEnabled":true,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"locale":"en","isPrivate":false,"logoBlobKey":"","allowedSchemes":"","isEmailAuthAllowed":false,"isFeedEnabled":false,"preventIndexing":false,"isModerationEnabled":false},"title":"My Page Title · "}
</script>
diff --git a/app/pkg/web/testdata/oauth.html b/app/pkg/web/testdata/oauth.html
index 7019812c2..6291ac1fc 100755
--- a/app/pkg/web/testdata/oauth.html
+++ b/app/pkg/web/testdata/oauth.html
@@ -45,7 +45,7 @@
<script id="server-data" type="application/json">
- {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[{"provider":"google","displayName":"Google","clientID":"1234","url":"https://demo.test.fider.io:3000/oauth/google","callbackURL":"https://demo.test.fider.io:3000/oauth/google/callback","logoBlobKey":"google.png","isCustomProvider":false,"isEnabled":true}],"postWithTags":true},"tenant":null,"title":"Fider"}
+ {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"isCommercialEnabled":true,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[{"provider":"google","displayName":"Google","clientID":"1234","url":"https://demo.test.fider.io:3000/oauth/google","callbackURL":"https://demo.test.fider.io:3000/oauth/google/callback","logoBlobKey":"google.png","isCustomProvider":false,"isEnabled":true}],"postWithTags":true},"tenant":null,"title":"Fider"}
</script>
diff --git a/app/pkg/web/testdata/tenant.html b/app/pkg/web/testdata/tenant.html
index 3792b4999..91ccd98a9 100755
--- a/app/pkg/web/testdata/tenant.html
+++ b/app/pkg/web/testdata/tenant.html
@@ -45,7 +45,7 @@
<script id="server-data" type="application/json">
- {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"locale":"","isPrivate":false,"logoBlobKey":"","allowedSchemes":"","isEmailAuthAllowed":false,"isFeedEnabled":false,"preventIndexing":false},"title":"Game of Thrones"}
+ {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"isCommercialEnabled":true,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"locale":"","isPrivate":false,"logoBlobKey":"","allowedSchemes":"","isEmailAuthAllowed":false,"isFeedEnabled":false,"preventIndexing":false,"isModerationEnabled":false},"title":"Game of Thrones"}
</script>
diff --git a/app/pkg/web/testdata/user.html b/app/pkg/web/testdata/user.html
index 2a7455e5d..805eddac3 100755
--- a/app/pkg/web/testdata/user.html
+++ b/app/pkg/web/testdata/user.html
@@ -45,7 +45,7 @@
<script id="server-data" type="application/json">
- {"contextID":"CONTEXT_ID","description":"My Page Description","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":null,"title":"My Page Title · Fider","user":{"avatarBlobKey":"","avatarType":"gravatar","avatarURL":"https://demo.test.fider.io:3000/static/avatars/gravatar/5/Jon%20Snow","email":"[email protected]","id":5,"isAdministrator":true,"isCollaborator":true,"name":"Jon Snow","role":"administrator","status":"active"}}
+ {"contextID":"CONTEXT_ID","description":"My Page Description","page":"","props":{},"sessionID":"","settings":{"allowAllowedSchemes":true,"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"isCommercialEnabled":true,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":null,"title":"My Page Title · Fider","user":{"avatarBlobKey":"","avatarType":"gravatar","avatarURL":"https://demo.test.fider.io:3000/static/avatars/gravatar/5/Jon%20Snow","email":"[email protected]","id":5,"isAdministrator":true,"isCollaborator":true,"isVerified":false,"name":"Jon Snow","role":"administrator","status":"active"}}
</script>
diff --git a/app/services/sqlstore/dbEntities/user.go b/app/services/sqlstore/dbEntities/user.go
index e4ae80cb2..1d32d08b0 100644
--- a/app/services/sqlstore/dbEntities/user.go
+++ b/app/services/sqlstore/dbEntities/user.go
@@ -42,7 +42,9 @@ func (u *User) ToModel(ctx context.Context) *entity.User {
tenant, ok := ctx.Value(app.TenantCtxKey).(*entity.Tenant)
if !ok || tenant == nil {
- tenant = u.Tenant.ToModel()
+ if u.Tenant != nil {
+ tenant = u.Tenant.ToModel()
+ }
}
avatarType := enum.AvatarType(u.AvatarType.Int64)
diff --git a/app/services/sqlstore/postgres/post_test.go b/app/services/sqlstore/postgres/post_test.go
index 0287abbaa..7d5720b6e 100644
--- a/app/services/sqlstore/postgres/post_test.go
+++ b/app/services/sqlstore/postgres/post_test.go
@@ -24,10 +24,10 @@ func TestPostStorage_GetAll(t *testing.T) {
now := time.Now()
- _, err := trx.Execute("INSERT INTO posts (title, slug, number, description, created_at, tenant_id, user_id, status) VALUES ('add twitter integration', 'add-twitter-integration', 1, 'Would be great to see it integrated with twitter', $1, 1, 1, 1)", now)
+ _, err := trx.Execute("INSERT INTO posts (title, slug, number, description, created_at, tenant_id, user_id, status, is_approved) VALUES ('add twitter integration', 'add-twitter-integration', 1, 'Would be great to see it integrated with twitter', $1, 1, 1, 1, true)", now)
Expect(err).IsNil()
- _, err = trx.Execute("INSERT INTO posts (title, slug, number, description, created_at, tenant_id, user_id, status) VALUES ('this is my post', 'this-is-my-post', 2, 'no description', $1, 1, 2, 2)", now)
+ _, err = trx.Execute("INSERT INTO posts (title, slug, number, description, created_at, tenant_id, user_id, status, is_approved) VALUES ('this is my post', 'this-is-my-post', 2, 'no description', $1, 1, 2, 2, true)", now)
Expect(err).IsNil()
allPosts := &query.GetAllPosts{}
diff --git a/app/services/sqlstore/postgres/tenant.go b/app/services/sqlstore/postgres/tenant.go
index 1f71c7f5d..6992e5ed5 100644
--- a/app/services/sqlstore/postgres/tenant.go
+++ b/app/services/sqlstore/postgres/tenant.go
@@ -17,8 +17,6 @@ import (
"github.com/getfider/fider/app/pkg/errors"
)
-
-
func isCNAMEAvailable(ctx context.Context, q *query.IsCNAMEAvailable) error {
return using(ctx, func(trx *dbx.Trx, tenant *entity.Tenant, user *entity.User) error {
tenantID := 0
@@ -175,8 +173,8 @@ func createTenant(ctx context.Context, c *cmd.CreateTenant) error {
var id int
err := trx.Get(&id,
- `INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing)
- VALUES ($1, $2, $3, '', '', '', $4, false, '', '', $5, true, true, true)
+ `INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing, is_moderation_enabled)
+ VALUES ($1, $2, $3, '', '', '', $4, false, '', '', $5, true, true, true, false)
RETURNING id`, c.Name, c.Subdomain, now, c.Status, env.Config.Locale)
if err != nil {
return err
@@ -222,7 +220,7 @@ func getTenantByDomain(ctx context.Context, q *query.GetTenantByDomain) error {
tenant := dbEntities.Tenant{}
err := trx.Get(&tenant, `
- SELECT id, name, subdomain, cname, invitation, locale, welcome_message, status, is_private, logo_bkey, custom_css, is_email_auth_allowed, is_feed_enabled, is_moderation_enabled, prevent_indexing
+ SELECT id, name, subdomain, cname, invitation, locale, welcome_message, status, is_private, logo_bkey, custom_css, allowed_schemes, is_email_auth_allowed, is_feed_enabled, is_moderation_enabled, prevent_indexing
FROM tenants t
WHERE subdomain = $1 OR subdomain = $2 OR cname = $3
ORDER BY cname DESC
diff --git a/app/services/sqlstore/postgres/tenant_test.go b/app/services/sqlstore/postgres/tenant_test.go
index b1f887b05..4011b318c 100644
--- a/app/services/sqlstore/postgres/tenant_test.go
+++ b/app/services/sqlstore/postgres/tenant_test.go
@@ -222,7 +222,7 @@ func TestTenantStorage_AdvancedSettings(t *testing.T) {
defer TeardownDatabaseTest()
err := bus.Dispatch(demoTenantCtx, &cmd.UpdateTenantAdvancedSettings{
- CustomCSS: ".primary { color: red; }",
+ CustomCSS: ".primary { color: red; }",
AllowedSchemes: "^monero:[48]\n^bitcoin:(1|3|bc1)",
})
Expect(err).IsNil()
diff --git a/app/services/sqlstore/postgres/user_test.go b/app/services/sqlstore/postgres/user_test.go
index a4253b83a..5461cfcbd 100644
--- a/app/services/sqlstore/postgres/user_test.go
+++ b/app/services/sqlstore/postgres/user_test.go
@@ -159,8 +159,8 @@ func TestUserStorage_Register_MultipleProviders(t *testing.T) {
var tenantID int
err := trx.Get(&tenantID, `
- INSERT INTO tenants (name, subdomain, created_at, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled)
- VALUES ('My Domain Inc.','mydomain', now(), 1, false, '', '', 'en', true, true)
+ INSERT INTO tenants (name, subdomain, created_at, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, is_moderation_enabled)
+ VALUES ('My Domain Inc.','mydomain', now(), 1, false, '', '', 'en', true, true, false)
RETURNING id
`)
Expect(err).IsNil()
diff --git a/docker-compose.yml b/docker-compose.yml
index ab60370e8..35e4b64f2 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -9,7 +9,7 @@ services:
pgdev:
container_name: fider_pgdev
restart: always
- image: postgres:12
+ image: postgres:17
volumes:
- pgdev-data:/var/lib/postgresql/data
ports:
@@ -20,7 +20,7 @@ services:
pgtest:
container_name: fider_pgtest
restart: always
- image: postgres:12
+ image: postgres:17
ports:
- "5566:5432"
environment:
diff --git a/package.json b/package.json
index a9d0c7d54..31dec9ab2 100644
--- a/package.json
+++ b/package.json
@@ -98,6 +98,7 @@
"moduleNameMapper": {
".*\\.(png|scss|svg)$": "<rootDir>/public/jest.assets.ts",
"@fider/(.*)": "<rootDir>/public/$1",
+ "@commercial/(.*)": "<rootDir>/commercial/$1",
"@locale/(.*)": "<rootDir>/locale/$1"
}
},