Skip to content

Commit

Permalink
leanInfoUpdates
Browse files Browse the repository at this point in the history
  • Loading branch information
lbwexler committed Jan 2, 2025
1 parent 99f63c6 commit 042dc1c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 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,22 @@ 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 ->
['group', 'isShared', 'isDefaultPinned'].contains(k) ?
(meta[k] = v) :
(core[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

1 comment on commit 042dc1c

@lbwexler
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Colin code reviewed this after it was a bit overeagerly committed to develop)

Please sign in to comment.