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

Extract organiser grant/revoke diffing from Admin::WorkshopsController

未关闭
#2,941 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
rails, ruby
领域
backend

调研方向

Read Admin::WorkshopsController and the existing app/services/ service objects to follow project conventions. Trace create and update, including assign_organisers_or_default and update_workshop_details, then run the existing admin workshop controller specs. Done means role changes behave identically for create/update, including the default-to-chapter-organisers path, and the controller no longer contains role-diffing logic.

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

描述

refactoring tech debt

Parent: #2938

Problem

Admin::WorkshopsController mutates Member roles directly from private controller methods, on both create (assign_organisers_or_default) and update (update_workshop_details):

def grant_organiser_access(organiser_ids = [])
  organiser_ids.each { |id| Member.find(id).add_role(:organiser, @workshop) }
end

def revoke_organiser_access(organiser_ids)
  (@workshop.organisers.pluck(:id).map(&:to_s) - organiser_ids).each do |id|
    Member.find(id).revoke(:organiser, @workshop)
  end
end

Diffing desired vs current organisers and mutating roles is application-layer orchestration, not HTTP coordination.

Proposed change

  • Extract the diff + grant/revoke into a service object under app/services/ (follow the existing *_service conventions there; naming up to the implementer).
  • The controller calls it from create/update; the default-to-chapter-organisers branch moves with it.

Acceptance

  • Admin::WorkshopsController no longer contains role-diffing logic.
  • Organiser membership changes identically after create/update, including the default-to-chapter-organisers path.
  • Existing admin workshop controller specs pass.
主要语言
Ruby
星标
104
派生
205
平均合并
1 天 4 小时
30 天内合并 PR
77

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

codebar/planner 的其他 Issue

查看 codebar/planner 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

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