|
@@ 90-106 (lines=17) @@
|
| 87 |
|
}); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
public function joinAction(Team $team, Player $me) |
| 91 |
|
{ |
| 92 |
|
$this->requireLogin(); |
| 93 |
|
if (!$me->isTeamless()) { |
| 94 |
|
throw new ForbiddenException("You are already a member of a team"); |
| 95 |
|
} elseif ($team->getStatus() != 'open') { |
| 96 |
|
throw new ForbiddenException("This team is not accepting new members without an invitation"); |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
return $this->showConfirmationForm(function () use ($team, $me) { |
| 100 |
|
$team->addMember($me->getId()); |
| 101 |
|
Service::getDispatcher()->dispatch(Events::TEAM_JOIN, new Event\TeamJoinEvent($team, $me)); |
| 102 |
|
|
| 103 |
|
return new RedirectResponse($team->getUrl()); |
| 104 |
|
}, "Are you sure you want to join {$team->getEscapedName()}?", |
| 105 |
|
"You are now a member of {$team->getName()}"); |
| 106 |
|
} |
| 107 |
|
|
| 108 |
|
public function kickAction(Team $team, Player $player, Player $me) |
| 109 |
|
{ |
|
@@ 130-147 (lines=18) @@
|
| 127 |
|
"Player {$player->getUsername()} has been kicked from {$team->getName()}", "Kick"); |
| 128 |
|
} |
| 129 |
|
|
| 130 |
|
public function abandonAction(Team $team, Player $me) |
| 131 |
|
{ |
| 132 |
|
if (!$team->isMember($me->getId())) { |
| 133 |
|
throw new ForbiddenException("You are not a member of that team!"); |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
if ($team->getLeader()->isSameAs($me)) { |
| 137 |
|
throw new ForbiddenException("You can't abandon the team you are leading."); |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
return $this->showConfirmationForm(function () use ($team, $me) { |
| 141 |
|
$team->removeMember($me->getId()); |
| 142 |
|
Service::getDispatcher()->dispatch(Events::TEAM_ABANDON, new Event\TeamAbandonEvent($team, $me)); |
| 143 |
|
|
| 144 |
|
return new RedirectResponse($team->getUrl()); |
| 145 |
|
}, "Are you sure you want to abandon {$team->getEscapedName()}?", |
| 146 |
|
"You have left {$team->getName()}", "Abandon"); |
| 147 |
|
} |
| 148 |
|
|
| 149 |
|
public function assignLeaderAction(Team $team, Player $me, Player $player) |
| 150 |
|
{ |