mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-26 19:20:59 +00:00
Prevent setting teammembers back to joining
This commit is contained in:
parent
1c22ba3482
commit
97755834f8
1 changed files with 3 additions and 0 deletions
|
@ -45,6 +45,9 @@ class TeamsController < ApplicationController
|
|||
new_rank = params[:rank]["#{member.id}"]
|
||||
# Can only set own rank to equal or lower than current rank
|
||||
if cuser.admin? or (new_rank.to_i <= cuser.teamers.active.of_team(@team).first.rank)
|
||||
# Don't allow setting members back to rank joining
|
||||
next if new_rank == Teamer::RANK_JOINER && member.rank != Teamer::RANK_JOINER
|
||||
|
||||
# Update team when rank changes from joiner to member or higher
|
||||
if member.rank == Teamer::RANK_JOINER && new_rank.to_i >= Teamer::RANK_MEMBER
|
||||
member.user.update_attribute :team, @team
|
||||
|
|
Loading…
Reference in a new issue