Skip to content

Commit 9fe8a84

Browse files
making sure keychain delete sync records are accurate as far as WHO triggered the action
1 parent 124739d commit 9fe8a84

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

models/boards.lisp

+3-2
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,8 @@
493493
"board"
494494
board-id
495495
"unshare"
496-
:rel-ids (list persona-user-id))))
496+
:rel-ids (list persona-user-id)
497+
:no-auto-add-user t)))
497498
(r:disconnect sock)
498499
(concatenate 'vector sync-ids share-sync-ids)))
499500

@@ -508,7 +509,7 @@
508509
(alet* ((sync-ids (do-delete-board-persona-link user-id board-id to-persona-id)))
509510
(if delete-keychain-entries
510511
(alet* ((to-user-id (gethash "user_id" to-persona))
511-
(keychain-sync (delete-keychain-tree to-user-id board-id)))
512+
(keychain-sync (delete-keychain-tree user-id to-user-id board-id)))
512513
(concatenate 'vector sync-ids keychain-sync))
513514
sync-ids))))
514515
;; user must have at least read-only access to board to be considered for

models/keychain.lisp

+7-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
(r:disconnect sock)
129129
(finish future (length entries))))))))
130130

131-
(adefun delete-keychain-tree (user-id board-id)
131+
(adefun delete-keychain-tree (from-user-id user-id board-id)
132132
"Grab a board's tree data (board, child boards, all notes contained therein)
133133
and for each item we no longer have at least read access to, remove that
134134
item's keychain entry (if it exists)."
@@ -159,7 +159,12 @@
159159
(map 'list (lambda (k) (gethash "id" k)) keychain-entries)))))
160160
(nil (r:run sock query))
161161
(sync-records (map 'vector
162-
(lambda (ke) (make-sync-record user-id "keychain" (gethash "id" ke) "delete"))
162+
(lambda (ke) (make-sync-record from-user-id
163+
"keychain"
164+
(gethash "id" ke)
165+
"delete"
166+
:rel-ids (list user-id)
167+
:no-auto-add-user t))
163168
keychain-entries))
164169
(nil (insert-sync-records sync-records)))
165170
;; return the sync id(s)

0 commit comments

Comments
 (0)