adjust self

This commit is contained in:
mr
2026-02-23 14:07:39 +01:00
parent 12c506e9a7
commit 19b0f10e71
5 changed files with 20 additions and 59 deletions

View File

@@ -64,18 +64,18 @@ func (a *collaborativeAreaMongoAccessor) UpdateOne(set utils.DBObject, id string
// StoreOne stores a collaborative area in the database, it automatically share to peers if the workspace is shared
func (a *collaborativeAreaMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) {
id, err := utils.GetMySelf((&peer.Peer{}).GetAccessor(&tools.APIRequest{
pp, err := utils.GetMySelf((&peer.Peer{}).GetAccessor(&tools.APIRequest{
Admin: true,
})) // get the local peer
if err != nil {
if err != nil || pp == nil {
return data, 404, err
}
data.(*CollaborativeArea).Clear(id) // set the creator
data.(*CollaborativeArea).Clear(pp.GetID()) // set the creator
// retrieve or proper peer
if data.(*CollaborativeArea).CollaborativeAreaRule != nil {
data.(*CollaborativeArea).CollaborativeAreaRule = &CollaborativeAreaRule{}
}
data.(*CollaborativeArea).CollaborativeAreaRule.Creator = id
data.(*CollaborativeArea).CollaborativeAreaRule.Creator = pp.GetID()
d, code, err := utils.GenericStoreOne(data.(*CollaborativeArea).Trim(), a)
if code == 200 {
a.sharedWorkflow(d.(*CollaborativeArea), d.GetID()) // create all shared workflows