mirror of
https://github.com/documize/community.git
synced 2025-07-21 14:19:43 +02:00
Change document activity records after space move
This commit is contained in:
parent
19a916a4b4
commit
5fb41e9fb1
3 changed files with 23 additions and 0 deletions
|
@ -238,6 +238,9 @@ func (s Scope) MoveDocumentSpace(ctx domain.RequestContext, id, move string) (er
|
|||
_, err = ctx.Transaction.Exec("UPDATE document SET labelid=? WHERE orgid=? AND labelid=?",
|
||||
move, ctx.OrgID, id)
|
||||
|
||||
if err == sql.ErrNoRows {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("execute document space move %s", id))
|
||||
}
|
||||
|
@ -245,6 +248,18 @@ func (s Scope) MoveDocumentSpace(ctx domain.RequestContext, id, move string) (er
|
|||
return
|
||||
}
|
||||
|
||||
// MoveActivity changes the space for all document activity records.
|
||||
func (s Scope) MoveActivity(ctx domain.RequestContext, documentID, oldSpaceID, newSpaceID string) (err error) {
|
||||
_, err = ctx.Transaction.Exec("UPDATE useractivity SET labelid=? WHERE orgid=? AND labelid=? AND documentid=?",
|
||||
newSpaceID, ctx.OrgID, oldSpaceID, documentID)
|
||||
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("execute document activity move %s", documentID))
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Delete removes the specified document.
|
||||
// Remove document pages, revisions, attachments, updates the search subsystem.
|
||||
func (s Scope) Delete(ctx domain.RequestContext, documentID string) (rows int64, err error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue