use saved pronouns and remove when leaving seat

This commit is contained in:
Alexander Fletcher 2022-05-30 20:13:56 +08:00
parent d0a117297c
commit 0e1cdbbb35
2 changed files with 11 additions and 3 deletions

View file

@ -333,6 +333,10 @@ export default {
claimSeat() {
this.isMenuOpen = false;
this.$emit("trigger", ["claimSeat"]);
const savedPronouns = localStorage.getItem("pronouns");
if (savedPronouns) {
this.updatePlayer("pronouns", savedPronouns);
}
},
/**
* Allow the ST to override a locked vote.

View file

@ -627,14 +627,18 @@ class LiveSession {
*/
_updateSeat([index, value]) {
if (this._isSpectator) return;
const property = "id";
const players = this._store.state.players.players;
// remove previous seat
const oldIndex = players.findIndex(({ id }) => id === value);
if (oldIndex >= 0 && oldIndex !== index) {
this._store.commit("players/update", {
player: players[oldIndex],
property,
property: "id",
value: ""
});
this._store.commit("players/update", {
player: players[oldIndex],
property: "pronouns",
value: ""
});
}
@ -642,7 +646,7 @@ class LiveSession {
if (index >= 0) {
const player = players[index];
if (!player) return;
this._store.commit("players/update", { player, property, value });
this._store.commit("players/update", { player, property: "id", value });
}
// update player session list as if this was a ping
this._handlePing([true, value, 0]);