Skip to content

Commit 7119529

Browse files
authored
ALLUSERS fix (#129)
* handle null title, remove email * 1.9.1
1 parent 096af3f commit 7119529

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "smartblocks",
3-
"version": "1.9.0",
3+
"version": "1.9.1",
44
"description": "Create custom and programmable templates from within Roam!",
55
"main": "./build/main.js",
66
"scripts": {

src/utils/core.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -2200,16 +2200,15 @@ export const COMMANDS: {
22002200
handler: () => {
22012201
const users = (
22022202
window.roamAlphaAPI.data.fast.q(
2203-
`[:find (pull ?p [:user/email]) (pull ?r [:node/title]) :where
2203+
`[:find (pull ?p [:user/uid]) (pull ?r [:node/title]) :where
22042204
[?p :user/display-page ?r]
22052205
]`
22062206
) as [PullBlock, PullBlock][]
2207-
).map(([p, r]) =>
2208-
r[":node/title"]?.startsWith("Anonymous") && p
2209-
? // @ts-ignore it does exist
2210-
(p[":user/email"] as string) || r[":node/title"]
2211-
: r?.[":node/title"] || ""
2212-
);
2207+
).map(([p, r]) => {
2208+
const userUid = p[":user/uid"] as string;
2209+
const title = r?.[":node/title"] || userUid;
2210+
return title.startsWith("Anonymous") ? userUid : title;
2211+
});
22132212
return users;
22142213
},
22152214
},

0 commit comments

Comments
 (0)