Impossibilité de fermer un ticket pour les membre après prise en charge + correction affichage des invitations
This commit is contained in:
parent
eb07cb67a2
commit
cd0fc4c488
3 changed files with 48 additions and 9 deletions
|
|
@ -1053,9 +1053,13 @@ class TicketManagementView(disnake.ui.View):
|
|||
f"ticket_user={getattr(self.ticket,'user_id',None)}"
|
||||
)
|
||||
# Vérifier si l'utilisateur peut fermer le ticket
|
||||
# Règle voulue:
|
||||
# - Staff: toujours autorisé
|
||||
# - Joueur: uniquement si le ticket n'est pas encore pris en charge (OPEN)
|
||||
can_close = (
|
||||
interaction.user.id == self.ticket.user_id or
|
||||
self._is_staff(interaction)
|
||||
self._is_staff(interaction) or (
|
||||
interaction.user.id == self.ticket.user_id and self.ticket.status == TicketStatus.OPEN
|
||||
)
|
||||
)
|
||||
|
||||
if not can_close:
|
||||
|
|
@ -1270,9 +1274,13 @@ class CloseConfirmationView(disnake.ui.View):
|
|||
async def confirm_callback(self, button: disnake.ui.Button, interaction: disnake.MessageInteraction):
|
||||
"""L'utilisateur confirme la fermeture"""
|
||||
# Vérifier les permissions
|
||||
# Règle voulue:
|
||||
# - Staff: toujours autorisé
|
||||
# - Joueur: uniquement si le ticket n'est pas encore pris en charge (OPEN)
|
||||
can_close = (
|
||||
interaction.user.id == self.ticket.user_id or
|
||||
self._is_staff(interaction)
|
||||
self._is_staff(interaction) or (
|
||||
interaction.user.id == self.ticket.user_id and self.ticket.status == TicketStatus.OPEN
|
||||
)
|
||||
)
|
||||
|
||||
if not can_close:
|
||||
|
|
@ -3486,7 +3494,16 @@ class TicketCommands(commands.Cog):
|
|||
return
|
||||
|
||||
# Vérifier que c'est du staff
|
||||
if not is_staff(inter, config, category):
|
||||
# Règle voulue:
|
||||
# - Staff: toujours autorisé
|
||||
# - Joueur: uniquement si le ticket n'est pas encore pris en charge (OPEN)
|
||||
# Ici on impose strictement staff (le bouton est staff dans la UI),
|
||||
# et on protège aussi contre un éventuel usage côté user.
|
||||
if (
|
||||
not is_staff(inter, config, category) and not (
|
||||
inter.user.id == ticket.user_id and ticket.status == TicketStatus.OPEN
|
||||
)
|
||||
):
|
||||
await inter.response.send_message("Réservé au staff.", ephemeral=True)
|
||||
return
|
||||
|
||||
|
|
@ -3562,9 +3579,13 @@ class TicketCommands(commands.Cog):
|
|||
await inter.response.send_message("Ticket non trouvé.", ephemeral=True)
|
||||
return
|
||||
|
||||
# Règle voulue:
|
||||
# - Staff: toujours autorisé
|
||||
# - Joueur: uniquement si le ticket n'est pas encore pris en charge (OPEN)
|
||||
can_close = (
|
||||
inter.user.id == ticket.user_id or
|
||||
is_staff(inter, config, config.get_category(ticket.category_id))
|
||||
is_staff(inter, config, config.get_category(ticket.category_id)) or (
|
||||
inter.user.id == ticket.user_id and ticket.status == TicketStatus.OPEN
|
||||
)
|
||||
)
|
||||
if not can_close:
|
||||
await inter.response.send_message("Vous ne pouvez pas fermer ce ticket.", ephemeral=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue