mirror of
https://github.com/documize/community.git
synced 2025-07-24 23:59:47 +02:00
Semver based in-app news and update notification
Ignore semver.patch for Whats New notifications. Use semver.major.minor.patch for Admin notifications. Changed endpoint to /news.
This commit is contained in:
parent
8d65c2d571
commit
0b85657536
8 changed files with 715 additions and 681 deletions
|
@ -59,10 +59,14 @@ func (s Scope) Get(ctx domain.RequestContext, id string) (sp space.Space, err er
|
|||
|
||||
// PublicSpaces returns spaces that anyone can see.
|
||||
func (s Scope) PublicSpaces(ctx domain.RequestContext, orgID string) (sp []space.Space, err error) {
|
||||
sql := "SELECT id,refid,label as name,orgid,userid,type,created,revised FROM label a where orgid=? AND type=1"
|
||||
qry := "SELECT id,refid,label as name,orgid,userid,type,created,revised FROM label a where orgid=? AND type=1"
|
||||
|
||||
err = s.Runtime.Db.Select(&sp, sql, orgID)
|
||||
err = s.Runtime.Db.Select(&sp, qry, orgID)
|
||||
|
||||
if err == sql.ErrNoRows {
|
||||
err = nil
|
||||
sp = []space.Space{}
|
||||
}
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("Unable to execute GetPublicFolders for org %s", orgID))
|
||||
}
|
||||
|
@ -78,7 +82,7 @@ func (s Scope) GetViewable(ctx domain.RequestContext) (sp []space.Space, err err
|
|||
WHERE orgid=?
|
||||
AND refid IN (SELECT refid FROM permission WHERE orgid=? AND location='space' AND refid IN (
|
||||
SELECT refid from permission WHERE orgid=? AND who='user' AND (whoid=? OR whoid='0') AND location='space' AND action='view' UNION ALL
|
||||
SELECT p.refid from permission p LEFT JOIN rolemember r ON p.whoid=r.roleid WHERE p.orgid=? AND p.who='role'
|
||||
SELECT p.refid from permission p LEFT JOIN rolemember r ON p.whoid=r.roleid WHERE p.orgid=? AND p.who='role'
|
||||
AND p.location='space' AND p.action='view' AND (r.userid=? OR r.userid='0')
|
||||
))
|
||||
ORDER BY name`
|
||||
|
@ -104,13 +108,17 @@ func (s Scope) GetViewable(ctx domain.RequestContext) (sp []space.Space, err err
|
|||
|
||||
// GetAll for admin users!
|
||||
func (s Scope) GetAll(ctx domain.RequestContext) (sp []space.Space, err error) {
|
||||
sql := `
|
||||
qry := `
|
||||
SELECT id,refid,label as name,orgid,userid,type,created,revised FROM label
|
||||
WHERE orgid=?
|
||||
ORDER BY name`
|
||||
|
||||
err = s.Runtime.Db.Select(&sp, sql, ctx.OrgID)
|
||||
err = s.Runtime.Db.Select(&sp, qry, ctx.OrgID)
|
||||
|
||||
if err == sql.ErrNoRows {
|
||||
err = nil
|
||||
sp = []space.Space{}
|
||||
}
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("failed space.GetAll org %s", ctx.OrgID))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue