feat: allow withdrawal of application unless rejected
This commit is contained in:
@@ -54,12 +54,14 @@ class ApplicationVoter extends Voter
|
|||||||
|
|
||||||
if ($this->security->isGranted('ROLE_TEAMER') && in_array($attribute, $teamerAttributes)) {
|
if ($this->security->isGranted('ROLE_TEAMER') && in_array($attribute, $teamerAttributes)) {
|
||||||
$teamer = $user->getTeamer();
|
$teamer = $user->getTeamer();
|
||||||
|
|
||||||
|
if ($teamer !== $application->getTeamer()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return match ($attribute) {
|
return match ($attribute) {
|
||||||
static::WITHDRAW => $teamer === $application->getTeamer(),
|
static::DELETE => Application::STATUS_REJECTED === $status,
|
||||||
static::DELETE => $teamer === $application->getTeamer()
|
static::VIEW, static::WITHDRAW => Application::STATUS_REJECTED !== $status,
|
||||||
&& Application::STATUS_REJECTED === $status,
|
|
||||||
static::VIEW => $teamer === $application->getTeamer()
|
|
||||||
&& Application::STATUS_REJECTED !== $status,
|
|
||||||
default => false,
|
default => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,14 @@
|
|||||||
{% if application.comment and application.commentVisible %}
|
{% if application.comment and application.commentVisible %}
|
||||||
<strong>Begründung:</strong> {{ application.comment|nl2br}}
|
<strong>Begründung:</strong> {{ application.comment|nl2br}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elseif application.status == constant('App\\Entity\\Application::STATUS_PENDING') %}
|
{% endif %}
|
||||||
|
{% if application.status == constant('App\\Entity\\Application::STATUS_PENDING') %}
|
||||||
<twig:MessageBox message="Deine Bewerbung befindet sich in Bearbeitung."/>
|
<twig:MessageBox message="Deine Bewerbung befindet sich in Bearbeitung."/>
|
||||||
{% if application.comment and application.commentVisible %}
|
{% if application.comment and application.commentVisible %}
|
||||||
<strong>Begründung:</strong> {{ application.comment|nl2br}}
|
<strong>Begründung:</strong> {{ application.comment|nl2br}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% endif %}
|
||||||
|
{% if is_granted('WITHDRAW', application) %}
|
||||||
<twig:MessageBox message="Du hast dich am {{ application.createdAt|date('d.m.Y') }} auf diesen Einsatz beworben."/>
|
<twig:MessageBox message="Du hast dich am {{ application.createdAt|date('d.m.Y') }} auf diesen Einsatz beworben."/>
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn btn--secondary"
|
class="btn btn--secondary"
|
||||||
|
|||||||
Reference in New Issue
Block a user