Skip to content

Don't crash on the first post of a user created by /localnewuser - #22

Open
courtneyr-dev wants to merge 1 commit into
scripting:mainfrom
courtneyr-dev:fix-localnewuser-prefs
Open

Don't crash on the first post of a user created by /localnewuser#22
courtneyr-dev wants to merge 1 commit into
scripting:mainfrom
courtneyr-dev:fix-localnewuser-prefs

Conversation

@courtneyr-dev

Copy link
Copy Markdown

A user created through /localnewuser has never called /saveprefs, so their prefs column is NULL and convertUser hands back a record with no prefs member. Their first /newpost then takes the whole server down:

TypeError: Cannot read properties of undefined (reading 'myFeedTitle')
    at buildFeedForUser (rssnetwork.js:1144)

To reproduce on a fresh server: /localnewuser, then /newpost.

One line: default prefs to an empty object in convertUser, the one place user rows are converted, so buildFeedForUser and getUserData always see the same shape. Verified on a fresh SQLite server: the post publishes, the feed builds with the fallback title, no crash.

🤖 Generated with Claude Code

A user created through /localnewuser has never called /saveprefs, so
their prefs column is NULL and convertUser hands back a record with no
prefs at all. The first post then takes the whole server down:

    TypeError: Cannot read properties of undefined (reading 'myFeedTitle')
        at buildFeedForUser (rssnetwork.js:1144)

because buildFeedForUser (and getUserData) read userRec.prefs.myFeedTitle
without a guard. Default prefs to an empty object in convertUser, the one
place user rows are converted, so every reader sees the same shape.

To reproduce on a fresh server: /localnewuser, then /newpost. With this
change the post publishes and the feed builds with the fallback title.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant