reddit / devvit

Reddit for Developers
https://developers.reddit.com
BSD 3-Clause "New" or "Revised" License
59 stars 13 forks source link

getModNotes fails if the user has any mod notes that do not contain a link #67

Closed fsvreddit closed 3 months ago

fsvreddit commented 3 months ago

When adding a mod note, mods have the option to not include a link to the contextual post or comment:

image

However if you then try and retrieve mod notes for the user this crashes. Example code:

const notes = await context.reddit.getModNotes({
    subreddit: "fsvsandbox",
    user: "fsv",
}).all();

The error is Error: Expected thing id to start with t1_, t2_, t3_, t4_, t5_, t6_ got }.

In the UserNote type, redditId is defined as redditId: T1ID | T3ID | T5ID; which means that if there is no linked post/comment/subreddit the object cannot be built.

fsvreddit commented 3 months ago

Duplicate of #33