mirror of
https://github.com/documize/community.git
synced 2025-07-20 05:39:42 +02:00
Fix missing return on error
This commit is contained in:
parent
fe7389e7ca
commit
153e38a5d4
3 changed files with 7 additions and 5 deletions
|
@ -48,7 +48,7 @@ func (s Scope) RecordUserActivity(ctx domain.RequestContext, activity activity.U
|
||||||
func (s Scope) GetDocumentActivity(ctx domain.RequestContext, id string) (a []activity.DocumentActivity, err error) {
|
func (s Scope) GetDocumentActivity(ctx domain.RequestContext, id string) (a []activity.DocumentActivity, err error) {
|
||||||
qry := `SELECT a.id, DATE(a.c_created) AS created, a.c_orgid AS orgid,
|
qry := `SELECT a.id, DATE(a.c_created) AS created, a.c_orgid AS orgid,
|
||||||
IFNULL(a.c_userid, '') AS userid, a.c_spaceid AS spaceid,
|
IFNULL(a.c_userid, '') AS userid, a.c_spaceid AS spaceid,
|
||||||
a.docid AS documentid, a.sectionid AS sectionid, a.c_activitytype AS activitytype,
|
a.c_docid AS documentid, a.c_sectionid AS sectionid, a.c_activitytype AS activitytype,
|
||||||
a.c_metadata AS metadata,
|
a.c_metadata AS metadata,
|
||||||
IFNULL(u.c_firstname, 'Anonymous') AS firstname, IFNULL(u.c_lastname, 'Viewer') AS lastname,
|
IFNULL(u.c_firstname, 'Anonymous') AS firstname, IFNULL(u.c_lastname, 'Viewer') AS lastname,
|
||||||
IFNULL(p.c_name, '') AS sectionname
|
IFNULL(p.c_name, '') AS sectionname
|
||||||
|
|
|
@ -93,6 +93,7 @@ func (h *Handler) Get(w http.ResponseWriter, r *http.Request) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Transaction.Rollback()
|
ctx.Transaction.Rollback()
|
||||||
h.Runtime.Log.Error(method, err)
|
h.Runtime.Log.Error(method, err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Transaction.Commit()
|
ctx.Transaction.Commit()
|
||||||
|
|
|
@ -221,14 +221,14 @@ func (s Scope) Update(ctx domain.RequestContext, document doc.Document) (err err
|
||||||
|
|
||||||
// UpdateGroup applies same values to all documents with the same group ID.
|
// UpdateGroup applies same values to all documents with the same group ID.
|
||||||
func (s Scope) UpdateGroup(ctx domain.RequestContext, d doc.Document) (err error) {
|
func (s Scope) UpdateGroup(ctx domain.RequestContext, d doc.Document) (err error) {
|
||||||
_, err = ctx.Transaction.Exec(`UPDATE dmz_doc SET c_name=?, c_desc? WHERE c_orgid=? AND c_groupid=?`,
|
_, err = ctx.Transaction.Exec(`UPDATE dmz_doc SET c_name=?, c_desc=? WHERE c_orgid=? AND c_groupid=?`,
|
||||||
d.Name, d.Excerpt, ctx.OrgID, d.GroupID)
|
d.Name, d.Excerpt, ctx.OrgID, d.GroupID)
|
||||||
|
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = errors.Wrap(err, "document.store.UpdateTitle")
|
err = errors.Wrap(err, "document.store.UpdateGroup")
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -347,10 +347,11 @@ func (s Scope) GetVersions(ctx domain.RequestContext, groupID string) (v []doc.V
|
||||||
v = []doc.Version{}
|
v = []doc.Version{}
|
||||||
|
|
||||||
err = s.Runtime.Db.Select(&v, `
|
err = s.Runtime.Db.Select(&v, `
|
||||||
SELECT c_versionid AS versionid, c_refid as documentid
|
SELECT c_versionid AS versionid, c_refid As documentid
|
||||||
FROM dmz_doc
|
FROM dmz_doc
|
||||||
WHERE c_orgid=? AND c_groupid=?
|
WHERE c_orgid=? AND c_groupid=?
|
||||||
ORDER BY c_versionorder`, ctx.OrgID, groupID)
|
ORDER BY c_versionorder`,
|
||||||
|
ctx.OrgID, groupID)
|
||||||
|
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
err = nil
|
err = nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue