Skip to content

Commit 4b8bf43

Browse files
author
Claude Code Agent
committed
fix(mafia-vue): prevent game master from kicking themselves
Two-part guard so the GM cannot accidentally kick themselves out of the room (which used to leave the room hostless until someone else claimed it): - Template: change the per-player kick button's v-if from 'admin' to 'admin && !p.admin', hiding the X next to the GM's own row. - Method: defensive check in kickPlayer — if the target name matches this.iPlayer.name, flash an alert and short-circuit before emitting the socket event. Covers the case where the component state somehow lets the button slip through, and keeps the rule local to the component without needing a server-side change. ReARM-Agentic-Session: no-self-kick-1779379668 ReARM-Agent: 324b2ca3-403e-4126-b353-4787140daa65
1 parent cbbdb27 commit 4b8bf43

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mafia-vue/src/components/CardShuffle.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<option v-for="i in computedOrderArray" :key="i" :value="i">{{ i }}</option>
4242
</select>
4343
<button
44-
v-if="admin"
44+
v-if="admin && !p.admin"
4545
class="player-kick"
4646
type="button"
4747
title="Kick player"
@@ -335,6 +335,10 @@ export default {
335335
}
336336
},
337337
kickPlayer (name) {
338+
if (name === this.iPlayer?.name) {
339+
this.flashAlert('You cannot kick yourself out of the room.')
340+
return
341+
}
338342
this.$socket.emit('kickplayer', { room: this.room, name })
339343
},
340344
requestMyPlayer () {

0 commit comments

Comments
 (0)