Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Investigate Custom Devise Mailer

未关闭
#4,384 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
停滞
技术栈
rails, ruby

调研方向

先从 app/mailers/custom_devise_mailer.rb 和 spec/mailers/custom_devise_mailer_spec.rb 开始,然后查看链接的历史提交和 pull request,以追踪邀请行为。验证每项完成标准,确认相关的发送者和角色检查,并运行 mailer spec;完成意味着逻辑有充分依据,且任何必要的更改都已由测试覆盖。

由索引模型根据 Issue 内容生成。

描述

Summary

So we have a custom devise mailer that seems to be responsible for setting the subject line for Partner invitations.. Tests for reference

The code looks something like this:

if resource.has_role?(Role::PARTNER, :any) && resource.id == resource.partner.primary_user&.id
  # do something
elsif resource.has_role?(Role::PARTNER, :any) && resource.id != resource.partner.primary_user&.id
  # do something else

This code (I think at least) sends one message if the user being invited is the primary user for the Partner and another if they are not.

Criteria for Completion

Figure out if this code is correct:

  • Does it make sense to check for resource.has_role?(Role::PARTNER, :any) as opposed to a specific partner
  • does it make sense for these invitations to get sent from a Partner vs a Org?
  • Do they even get sent from a Partner and not an Org?
  • If we change the code to check for a specific partner will there be any issues?
  • If it seems reasonable and necessary make the change 🙂
Historical context:

The mailer was originally added here: https://github.com/rubyforgood/human-essentials/commit/ff961af7f5051ec6e05dd9cdd4d055b5e650431d. It simply changed the invite message for inviting Partners instead of Orgs.

    if resource.is_a?(PartnerUser)
      "You've been invited to be a partner with #{resource.partner.organization.name}"  

https://github.com/rubyforgood/human-essentials/pull/2232 allowed Partners to invite coworkers by checking that the inviter was the primary user for that Partner:

 if resource.is_a?(PartnerUser) && resource.id != resource.partner.primary_user&.id
      "You've been invited to #{resource.partner.name}'s partnerbase account"

https://github.com/rubyforgood/human-essentials/pull/3050 got rid of PartnerUsers and instead used partner_id

if resource.try(:partner_id) && resource.id == resource.partner.primary_user&.id
      "You've been invited to be a partner with #{resource.partner.organization.name}"

https://github.com/rubyforgood/human-essentials/pull/3117 finally when roles got added we started checking by role instead of partner_id

if resource.has_role?(Role::PARTNER, :any) && resource.id == resource.partner.primary_user&.id
      "You've been invited to be a partner with #{resource.partner.organization.name}"
主要语言
Ruby
星标
594
派生
596
平均合并
1 天 17 小时
30 天内合并 PR
12

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rubyforgood/human-essentials 的其他 Issue

查看 rubyforgood/human-essentials 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。