Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a user is banned, the context provided is not passed through. #99

Closed
fsvreddit opened this issue Sep 29, 2024 · 0 comments · Fixed by #100
Closed

When a user is banned, the context provided is not passed through. #99

fsvreddit opened this issue Sep 29, 2024 · 0 comments · Fixed by #100

Comments

@fsvreddit
Copy link
Contributor

If you ban a user from a Devvit app and provide a value for context (which is supposed to be the T1ID/T3ID of the content the user is being banned for), the message received by the user doesn't contain a link to the content:

Hello, You have been banned from participating in r/fsvsandbox for 1 day because you broke this community's rules. You won't be able to post or comment, but you can still view and subscribe to it.

What I would expect is:

Hello, You have been banned from participating in r/UKInvesting for 999 days because [your post](link) violates this community's rules. You won't be able to post or comment, but you can still view and subscribe to it.

Example code:

        await context.reddit.banUser({
            subredditName: "fsvsandbox",
            username: "fsvtestalt",
            context: "t3_1esvalw",
            duration: 1,
        });
pl00h pushed a commit that referenced this issue Oct 10, 2024
<!-- If this pull request closes an issue, please mention the issue
number below -->
Fixes #99

## 💸 TL;DR
When a user is banned, the `context` property of the BanUserOptions type
is not passed up to User.createRelationship. This means that the modmail
received by the user does not include full details of why the user has
been banned.

## 🧪 Testing Steps / Validation
Example code:

Via reddit API:
```ts
  await context.reddit.banUser({
      subredditName: "fsvsandbox",
      username: "fsvtestalt",
      context: "t3_1esvalw",
      duration: 1,
  });
```

Via method on `Subreddit` class:
```ts
  const subreddit = await context.reddit.getCurrentSubreddit();
  await subreddit.banUser({
      username: "fsvtestalt",
      context: "t3_1esvalw",
      duration: 1,
  });
```

Expected outcome: the modmail sent to the end user should include a link
to the post or comment that is referenced by the context attribute.

## ✅ Checks
<!-- Make sure your pr passes the CI checks and do check the following
fields as needed - -->
- [x] CI tests (if present) are passing
- [x] Adheres to code style for repo
- [x] Contributor License Agreement (CLA) completed if not a Reddit
employee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant