Skip to content

Fix NSFW property on User model and add missing properties#256

Merged
stephenoid merged 1 commit intoreddit:mainfrom
fsvreddit:UserFixes
Apr 28, 2026
Merged

Fix NSFW property on User model and add missing properties#256
stephenoid merged 1 commit intoreddit:mainfrom
fsvreddit:UserFixes

Conversation

@fsvreddit
Copy link
Copy Markdown
Contributor

Closes #193

💸 TL;DR

This pull request addresses two issues on the User model:

  • NSFW property is returning the wrong value - it currently returns the "I am over 18 and want to see NSFW content" property, rather than the "I am NSFW" property.
  • Two underlying properties available on the Data API (isMod and isGold) are not available on the User model. I am now exposing these properly, using the current "Reddit Premium" terminology instead of Reddit Gold.

🧪 Testing Steps / Validation

I have tested these locally by modifying files in the node_modules folder. However it is not possible for me to run full CI on this.

For some time I have had my own User model that transforms these values in the same way.

✅ Checks

  • CI tests (if present) are passing
  • Adheres to code style for repo
  • Contributor License Agreement (CLA) completed if not a Reddit employee

@fsvreddit fsvreddit requested a review from a team as a code owner April 28, 2026 13:21
Copy link
Copy Markdown
Member

@stephenoid stephenoid left a comment

Choose a reason for hiding this comment

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

looks good! thanks!

Comment thread packages/reddit/src/models/User.ts
Comment thread packages/reddit/src/models/User.ts
Comment thread packages/reddit/src/models/User.ts
@stephenoid stephenoid merged commit b3c7e46 into reddit:main Apr 28, 2026
stephenoid added a commit that referenced this pull request Apr 29, 2026
…257)

<!-- If this pull request closes an issue, please mention the issue
number below -->
Closes #193 

## 💸 TL;DR

My last PR (#256) only made a change on the reddit package for Devvit
Web. Sorry about this - this closes the same gaps on the classic
reddit-api package.

This pull request addresses two issues on the `User` model:
* NSFW property is returning the wrong value - it currently returns the
"I am over 18 and want to see NSFW content" property, rather than the "I
am NSFW" property.
* Two underlying properties available on the Data API (isMod and isGold)
are not available on the User model. I am now exposing these properly,
using the current "Reddit Premium" terminology instead of Reddit Gold.

## 🧪 Testing Steps / Validation
I have tested these locally by modifying files in the node_modules
folder. However it is not possible for me to run full CI on this.

For some time I have had my own User model that transforms these values
in the same way.

## ✅ Checks
<!-- Make sure your pr passes the CI checks and do check the following
fields as needed - -->
- [ ] CI tests (if present) are passing
- [X] Adheres to code style for repo
- [X] Contributor License Agreement (CLA) completed if not a Reddit
employee

Co-authored-by: stephenoid <stephenoid@oidoid.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

User class nsfw getter not wokring

2 participants