Skip to content

Commit c235fb5

Browse files
committed
bumped version
1 parent 07c8238 commit c235fb5

File tree

9 files changed

+819
-664
lines changed

9 files changed

+819
-664
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The mission is to bring software dev inspired features (refactoring, testing, li
88

99
## Latest version
1010

11-
v1.52.2
11+
v1.53.0
1212

1313
## OS Support
1414

core/database/migrate.go

-3
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,8 @@ type migrationsT []string
3535

3636
// migrations returns a list of the migrations to update the database as required for this version of the code.
3737
func migrations(lastMigration string) (migrationsT, error) {
38-
3938
lastMigration = strings.TrimPrefix(strings.TrimSuffix(lastMigration, `"`), `"`)
4039

41-
//fmt.Println(`DEBUG Migrations("`+lastMigration+`")`)
42-
4340
files, err := web.AssetDir(migrationsDir)
4441
if err != nil {
4542
return nil, err

domain/meta/endpoint.go

+27-23
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (h *Handler) RobotsTxt(w http.ResponseWriter, r *http.Request) {
6969
ctx := domain.GetRequestContext(r)
7070

7171
dom := organization.GetSubdomainFromHost(r)
72-
org, err := h.Store.Organization.GetOrganizationByDomain(dom)
72+
o, err := h.Store.Organization.GetOrganizationByDomain(dom)
7373

7474
// default is to deny
7575
robots :=
@@ -78,29 +78,31 @@ func (h *Handler) RobotsTxt(w http.ResponseWriter, r *http.Request) {
7878
`
7979

8080
if err != nil {
81-
h.Runtime.Log.Error(fmt.Sprintf("%s failed to get Organization for domain %s", method, dom), err)
81+
h.Runtime.Log.Info(fmt.Sprintf("%s failed to get Organization for domain %s", method, dom))
82+
o = org.Organization{}
83+
o.AllowAnonymousAccess = false
8284
}
8385

8486
// Anonymous access would mean we allow bots to crawl.
85-
if org.AllowAnonymousAccess {
87+
if o.AllowAnonymousAccess {
8688
sitemap := ctx.GetAppURL("sitemap.xml")
8789
robots = fmt.Sprintf(
8890
`User-agent: *
89-
Disallow: /settings/
90-
Disallow: /settings/*
91-
Disallow: /profile/
92-
Disallow: /profile/*
93-
Disallow: /auth/login/
94-
Disallow: /auth/login/
95-
Disallow: /auth/logout/
96-
Disallow: /auth/logout/*
97-
Disallow: /auth/reset/*
98-
Disallow: /auth/reset/*
99-
Disallow: /auth/sso/
100-
Disallow: /auth/sso/*
101-
Disallow: /share
102-
Disallow: /share/*
103-
Sitemap: %s`, sitemap)
91+
Disallow: /settings/
92+
Disallow: /settings/*
93+
Disallow: /profile/
94+
Disallow: /profile/*
95+
Disallow: /auth/login/
96+
Disallow: /auth/login/
97+
Disallow: /auth/logout/
98+
Disallow: /auth/logout/*
99+
Disallow: /auth/reset/*
100+
Disallow: /auth/reset/*
101+
Disallow: /auth/sso/
102+
Disallow: /auth/sso/*
103+
Disallow: /share
104+
Disallow: /share/*
105+
Sitemap: %s`, sitemap)
104106
}
105107

106108
response.WriteBytes(w, []byte(robots))
@@ -113,10 +115,12 @@ func (h *Handler) Sitemap(w http.ResponseWriter, r *http.Request) {
113115
ctx := domain.GetRequestContext(r)
114116

115117
dom := organization.GetSubdomainFromHost(r)
116-
org, err := h.Store.Organization.GetOrganizationByDomain(dom)
118+
o, err := h.Store.Organization.GetOrganizationByDomain(dom)
117119

118120
if err != nil {
119-
h.Runtime.Log.Error(fmt.Sprintf("%s failed to get Organization for domain %s", method, dom), err)
121+
h.Runtime.Log.Info(fmt.Sprintf("%s failed to get Organization for domain %s", method, dom))
122+
o = org.Organization{}
123+
o.AllowAnonymousAccess = false
120124
}
121125

122126
sitemap :=
@@ -131,9 +135,9 @@ func (h *Handler) Sitemap(w http.ResponseWriter, r *http.Request) {
131135
var items []sitemapItem
132136

133137
// Anonymous access means we announce folders/documents shared with 'Everyone'.
134-
if org.AllowAnonymousAccess {
138+
if o.AllowAnonymousAccess {
135139
// Grab shared folders
136-
folders, err := h.Store.Space.PublicSpaces(ctx, org.RefID)
140+
folders, err := h.Store.Space.PublicSpaces(ctx, o.RefID)
137141
if err != nil {
138142
folders = []space.Space{}
139143
h.Runtime.Log.Error(fmt.Sprintf("%s failed to get folders for domain %s", method, dom), err)
@@ -148,7 +152,7 @@ func (h *Handler) Sitemap(w http.ResponseWriter, r *http.Request) {
148152

149153
// Grab documents from shared folders
150154
var documents []doc.SitemapDocument
151-
documents, err = h.Store.Document.PublicDocuments(ctx, org.RefID)
155+
documents, err = h.Store.Document.PublicDocuments(ctx, o.RefID)
152156
if err != nil {
153157
documents = []doc.SitemapDocument{}
154158
h.Runtime.Log.Error(fmt.Sprintf("%s failed to get documents for domain %s", method, dom), err)

domain/space/space_test.go

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
package space
2+
3+
import (
4+
"testing"
5+
6+
"github.com/documize/community/core/uniqueid"
7+
"github.com/documize/community/domain/test"
8+
"github.com/documize/community/model/space"
9+
)
10+
11+
//add a new space and get it. if the get returns the same space as the one just added it passes the test
12+
func TestAddSpace(t *testing.T) {
13+
//Setup - get the necessary info to add a space, generate a test space
14+
rt, s, ctx := test.SetupTest()
15+
var err error
16+
17+
//Run test - Add a space to the DB, read it to make sure it was added correctly
18+
ctx.Transaction, err = rt.Db.Beginx()
19+
if err != nil {
20+
return
21+
}
22+
sp := space.Space{}
23+
sp.RefID = uniqueid.Generate()
24+
sp.OrgID = ctx.OrgID
25+
sp.Type = space.ScopePrivate
26+
sp.UserID = ctx.UserID
27+
sp.Name = "test"
28+
29+
err = s.Space.Add(ctx, sp)
30+
if err != nil {
31+
ctx.Transaction.Rollback()
32+
return
33+
}
34+
ctx.Transaction.Commit()
35+
36+
sp2, err := s.Space.Get(ctx, sp.RefID)
37+
if err != nil {
38+
return
39+
}
40+
41+
if sp != sp2 {
42+
t.Errorf("Test Failed, space one (%v) does not match space 2(%v)", sp, sp2)
43+
}
44+
}
45+
46+
// Function to create a space with an identifier, remove it and then try get it using that Identifier, if it doesnt get it, it is removed
47+
// func TestRemoveSpace(t *testing.T) {
48+
// //Setup - get the necessary info to add a space, generate a test space
49+
// rt, s, ctx := test.SetupTest()
50+
// var err error
51+
// println("marker 1")
52+
53+
// //Run test - Add a space
54+
// ctx.Transaction, err = rt.Db.Beginx()
55+
// if err != nil {
56+
// return
57+
// }
58+
59+
// println("marker 2")
60+
61+
// sp := space.Space{}
62+
// sp.RefID = uniqueid.Generate()
63+
// sp.OrgID = ctx.OrgID
64+
// sp.Type = space.ScopePrivate
65+
// sp.UserID = ctx.UserID
66+
// sp.Name = "test-toBeDeleted"
67+
68+
// println("marker 3")
69+
70+
// err = s.Space.Add(ctx, sp)
71+
// if err != nil {
72+
// ctx.Transaction.Rollback()
73+
// return
74+
// }
75+
// ctx.Transaction.Commit()
76+
77+
// //Remove the space
78+
// ctx.Transaction, err = rt.Db.Beginx()
79+
80+
// _, err = s.Space.Delete(ctx, sp.RefID)
81+
82+
// move := "moveToId"
83+
84+
// err = s.Document.MoveDocumentSpace(ctx, sp.RefID, move)
85+
86+
// err = s.Space.MoveSpaceRoles(ctx, sp.RefID, move)
87+
88+
// _, err = s.Pin.DeletePinnedSpace(ctx, sp.RefID)
89+
90+
// s.Audit.Record(ctx, audit.EventTypeSpaceDelete)
91+
92+
// ctx.Transaction.Commit()
93+
94+
// _, err = s.Space.Get(ctx, sp.RefID)
95+
// }

domain/test/test.go

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package test
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/documize/community/core/env"
7+
"github.com/documize/community/domain"
8+
"github.com/documize/community/edition/boot"
9+
"github.com/documize/community/edition/logging"
10+
_ "github.com/go-sql-driver/mysql" // testing
11+
)
12+
13+
// SetupTest prepares test environment
14+
func SetupTest() (rt *env.Runtime, s *domain.Store, ctx domain.RequestContext) {
15+
rt, s = startRuntime()
16+
ctx = setupContext()
17+
return rt, s, ctx
18+
}
19+
20+
func startRuntime() (rt *env.Runtime, s *domain.Store) {
21+
rt = new(env.Runtime)
22+
s = new(domain.Store)
23+
rt.Log = logging.NewLogger()
24+
25+
rt.Product = env.ProdInfo{}
26+
rt.Product.Major = "0"
27+
rt.Product.Minor = "0"
28+
rt.Product.Patch = "0"
29+
rt.Product.Version = fmt.Sprintf("%s.%s.%s", rt.Product.Major, rt.Product.Minor, rt.Product.Patch)
30+
rt.Product.Edition = "Test"
31+
rt.Product.Title = fmt.Sprintf("%s Edition", rt.Product.Edition)
32+
rt.Product.License = env.License{}
33+
rt.Product.License.Seats = 1
34+
rt.Product.License.Valid = true
35+
rt.Product.License.Trial = false
36+
rt.Product.License.Edition = "Community"
37+
38+
// parse settings from command line and environment
39+
rt.Flags = env.ParseFlags()
40+
boot.InitRuntime(rt, s)
41+
42+
// section.Register(rt, s)
43+
44+
return rt, s
45+
}
46+
47+
// setup testing context
48+
func setupContext() domain.RequestContext {
49+
ctx := domain.RequestContext{}
50+
ctx.AllowAnonymousAccess = true
51+
ctx.Authenticated = true
52+
ctx.Administrator = true
53+
ctx.Guest = false
54+
ctx.Editor = true
55+
ctx.Global = true
56+
ctx.UserID = "1"
57+
ctx.OrgID = "1"
58+
return ctx
59+
}

edition/community.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ func main() {
3737
// product details
3838
rt.Product = env.ProdInfo{}
3939
rt.Product.Major = "1"
40-
rt.Product.Minor = "52"
41-
rt.Product.Patch = "2"
40+
rt.Product.Minor = "53"
41+
rt.Product.Patch = "0"
4242
rt.Product.Version = fmt.Sprintf("%s.%s.%s", rt.Product.Major, rt.Product.Minor, rt.Product.Patch)
4343
rt.Product.Edition = "Community"
4444
rt.Product.Title = fmt.Sprintf("%s Edition", rt.Product.Edition)

embed/bindata_assetfs.go

+628-628
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "documize",
3-
"version": "1.52.2",
3+
"version": "1.53.0",
44
"description": "The Document IDE",
55
"private": true,
66
"repository": "",

meta.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"community":
33
{
4-
"version": "1.52.2",
4+
"version": "1.53.0",
55
"major": 1,
6-
"minor": 52,
7-
"patch": 2
6+
"minor": 53,
7+
"patch": 0
88
},
99
"enterprise":
1010
{
11-
"version": "1.54.2",
11+
"version": "1.55.0",
1212
"major": 1,
13-
"minor": 54,
14-
"patch": 2
13+
"minor": 55,
14+
"patch": 0
1515
}
1616
}

0 commit comments

Comments
 (0)