Skip to content

Commit

Permalink
Merge branch 'develop' into multiInstanceCompare
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwexler committed Jan 3, 2025
2 parents 8f1fe7d + a41282c commit d52a6fc
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions grails-app/services/io/xh/hoist/view/ViewService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,23 @@ class ViewService extends BaseService {
/** Update a view's metadata */
Map updateInfo(String token, Map data, String username = username) {
def existing = jsonBlobService.get(token, username),
existingMeta = parseObject(existing.meta),
isGlobal = !existing.owner,
isShared = data.containsKey('isShared') ? data.isShared : existingMeta.isShared;
meta = parseObject(existing.meta) ?: [:],
core = [:]

data.each { k, v ->
if (['name', 'description'].contains(k)) {
core[k] = v
} else if (['group', 'isShared', 'isDefaultPinned'].contains(k)) {
meta[k] = v
}
}

def ret = jsonBlobService.update(
token,
[
* : data,
acl : isGlobal || isShared ? '*' : null,
meta: isGlobal ?
[group: data.group, isDefaultPinned: !!data.isDefaultPinned] :
[group: data.group, isShared: !!data.isShared],
*: core,
meta: meta,
acl: !existing.owner || meta.isShared ? '*' : null
],
username
)
Expand Down

0 comments on commit d52a6fc

Please sign in to comment.