Skip to content

Feature - Ban Email #4980

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

OmarMoataz
Copy link
Contributor

@OmarMoataz OmarMoataz commented Apr 26, 2025

Because

Added ban email feature to notify the user that they've been banned.

This PR

  • Added ban mailer
  • Added ban email preview
  • Added both text and html version of the email for graceful degredation.

Issue

Closes #4666

Additional Information

image

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this PR follows the keyword: brief description of change format, using one of the following keywords:
    • Feature - adds new or amends existing user-facing behavior
    • Chore - changes that have no user-facing value, refactors, dependency bumps, etc
    • Fix - bug fixes
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • I have verified all tests and linters pass after making these changes.
  • If this PR addresses an open issue, it is linked in the Issue section
  • If applicable, this PR includes new or updated automated tests

- Made 'for example' on its own line.
- Made unordered list for ban reasons.
- Made it look a little nicer.
Copy link
Member

@KevinMulhern KevinMulhern left a comment

Choose a reason for hiding this comment

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

Thanks for doing this @OmarMoataz!

I've left some minor feedback, let me know if I can help with anything.

class BanMailer < ApplicationMailer
default from: 'The Odin Project <[email protected]>'

def send_ban_email_to(user)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Because this is a user related email, I think it should live in the UserMailer along side the welcome email.


def send_email(project_submission_owner)
ban_mailer = BanMailer.new
ban_mailer.send_ban_email_to(project_submission_owner)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I think this will wait until the email is sent within the same request/response cycle, slowing the response down. We can send the email in the background instead:

UserMailer.send_ban_email_to(project_submission_owner).deliver_later

@@ -0,0 +1,101 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Copy link
Member

Choose a reason for hiding this comment

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

I've left some minor feedback about the email content on the issue.

One of your project submissions contained NSFW or other highly offensive images
One of your project submissions contained bigotry, such as racism, homophobia, hate speech
One of your project submissions were plagiarized
If you are unsure of the rules that were broken, you may reach out to us at [email protected]
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Can we add a new line above this please?

@github-project-automation github-project-automation bot moved this from 📋 Backlog / Ideas to 🏗 In progress in Main Site May 5, 2025
@OmarMoataz
Copy link
Contributor Author

Hey, I'll work on this a bit more. I realize there's one test failing as well but I haven't had enough time to sink my teeth into this sooner. I'll also work on your comments. Thanks, Kevin!

@KevinMulhern
Copy link
Member

Hey @OmarMoataz, hope things are well? do you need any help getting this finished?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

Feature Request: Add a ban message
2 participants