mirror of
https://github.com/documize/community.git
synced 2025-07-21 14:19:43 +02:00
Enforce non-draft mode lifecycle for CE
Closes #151 by enforcing non-draft mode settings for Community Edition.
This commit is contained in:
parent
fb193ce9f9
commit
c94fd9cfcf
3 changed files with 19 additions and 2 deletions
7
core/env/runtime.go
vendored
7
core/env/runtime.go
vendored
|
@ -50,3 +50,10 @@ const (
|
||||||
// DBVariantPostgreSQL is PostgreSQL
|
// DBVariantPostgreSQL is PostgreSQL
|
||||||
DBVariantPostgreSQL DbVariant = "PostgreSQL"
|
DBVariantPostgreSQL DbVariant = "PostgreSQL"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// CommunityEdition is AGPL product variant
|
||||||
|
CommunityEdition = "Community"
|
||||||
|
// EnterpriseEdition is commercial licensed product variant
|
||||||
|
EnterpriseEdition = "Enterprise"
|
||||||
|
)
|
||||||
|
|
|
@ -35,6 +35,7 @@ import (
|
||||||
"github.com/documize/community/model/doc"
|
"github.com/documize/community/model/doc"
|
||||||
"github.com/documize/community/model/page"
|
"github.com/documize/community/model/page"
|
||||||
"github.com/documize/community/model/space"
|
"github.com/documize/community/model/space"
|
||||||
|
"github.com/documize/community/model/workflow"
|
||||||
uuid "github.com/nu7hatch/gouuid"
|
uuid "github.com/nu7hatch/gouuid"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
@ -174,8 +175,12 @@ func processDocument(ctx domain.RequestContext, r *env.Runtime, store *domain.St
|
||||||
document.UserID = ctx.UserID
|
document.UserID = ctx.UserID
|
||||||
documentID := uniqueid.Generate()
|
documentID := uniqueid.Generate()
|
||||||
document.RefID = documentID
|
document.RefID = documentID
|
||||||
document.Lifecycle = sp.Lifecycle
|
|
||||||
|
|
||||||
|
if r.Product.Edition == env.CommunityEdition {
|
||||||
|
document.Lifecycle = workflow.LifecycleLive
|
||||||
|
} else {
|
||||||
|
document.Lifecycle = sp.Lifecycle
|
||||||
|
}
|
||||||
err = store.Document.Add(ctx, document)
|
err = store.Document.Add(ctx, document)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Transaction.Rollback()
|
ctx.Transaction.Rollback()
|
||||||
|
|
|
@ -316,7 +316,12 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) {
|
||||||
d.LabelID = folderID
|
d.LabelID = folderID
|
||||||
d.UserID = ctx.UserID
|
d.UserID = ctx.UserID
|
||||||
d.Title = docTitle
|
d.Title = docTitle
|
||||||
|
|
||||||
|
if h.Runtime.Product.Edition == env.CommunityEdition {
|
||||||
|
d.Lifecycle = workflow.LifecycleLive
|
||||||
|
} else {
|
||||||
d.Lifecycle = sp.Lifecycle
|
d.Lifecycle = sp.Lifecycle
|
||||||
|
}
|
||||||
|
|
||||||
err = h.Store.Document.Add(ctx, d)
|
err = h.Store.Document.Add(ctx, d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue