Skip to content

Commit

Permalink
Allow moderators to add members to teams
Browse files Browse the repository at this point in the history
  • Loading branch information
BGMP committed Jun 4, 2024
1 parent 1c33f23 commit 4f62a4c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/teams_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class TeamsController < ApplicationController
before_action :authenticate_user!, :except => [:show, :index]
before_action :authenticate_admin, :except => [:show, :index]
before_action :authenticate_mod, :except => [:show, :index]
before_action :set_team, :only => [:show, :edit, :update, :add_member, :destroy]

respond_to :html, :json
Expand Down
1 change: 1 addition & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def edit
user_attr_names.each do |attr|
next if params[:user][attr].nil?

# FIXME: When users don't have a team_id attr, this fails to update their team
if attr.eql?("team_id")
team = Team.all.find { |t| t.leader.id.eql?(user.id) }

Expand Down
2 changes: 1 addition & 1 deletion app/views/teams/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
%td
= t("teams.table.role.member")

- if user_is_admin?
- if user_is_mod? || user_is_admin?
= form_with :url => add_member_teams_path, method: :put do |f|
.row
.col-md-5
Expand Down

0 comments on commit 4f62a4c

Please sign in to comment.