From 79d6277e05afd65a99e270e516948b6c08d91651 Mon Sep 17 00:00:00 2001
From: Jeff Heiges <jehe8729@colorado.edu>
Date: Tue, 11 Mar 2025 07:38:43 +0000
Subject: Fixed errors of the form Do not access Object.prototype method
 'hasOwnProperty' from target object  no-prototype-builtins

---
 diplomacy/web/src/gui/pages/page.jsx | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

(limited to 'diplomacy/web')

diff --git a/diplomacy/web/src/gui/pages/page.jsx b/diplomacy/web/src/gui/pages/page.jsx
index 95b4482..4185e96 100644
--- a/diplomacy/web/src/gui/pages/page.jsx
+++ b/diplomacy/web/src/gui/pages/page.jsx
@@ -200,7 +200,7 @@ export class Page extends React.Component {
         let gamesFound = null;
         for (let gameToAdd of gamesToAdd) {
             myGames[gameToAdd.game_id] = gameToAdd;
-            if (this.state.games.hasOwnProperty(gameToAdd.game_id)) {
+            if (Object.prototype.hasOwnProperty.call(this.state.myGames, gameToAdd.gameID)) {
                 if (!gamesFound)
                     gamesFound = Object.assign({}, this.state.games);
                 gamesFound[gameToAdd.game_id] = gameToAdd;
@@ -212,7 +212,7 @@ export class Page extends React.Component {
     }
 
     getGame(gameID) {
-        if (this.state.myGames.hasOwnProperty(gameID))
+	if (Object.prototype.hasOwnProperty.call(this.state.games, gameID))
             return this.state.myGames[gameID];
         return this.state.games[gameID];
     }
@@ -229,7 +229,7 @@ export class Page extends React.Component {
         const gamesFound = {};
         for (let game of gamesToAdd) {
             gamesFound[game.game_id] = (
-                this.state.myGames.hasOwnProperty(game.game_id) ?
+                Object.prototype.hasOwnProperty.call(this.state.myGames, game.gameID) ?
                     this.state.myGames[game.game_id] : game
             );
         }
@@ -237,7 +237,7 @@ export class Page extends React.Component {
     }
 
     leaveGame(gameID) {
-        if (this.state.myGames.hasOwnProperty(gameID)) {
+	if (Object.prototype.hasOwnProperty.call(this.state.games, gameID)) {
             const game = this.state.myGames[gameID];
             if (game.client) {
                 return game.client.leave()
@@ -295,15 +295,15 @@ export class Page extends React.Component {
 
     _add_to_my_games(game) {
         const myGames = Object.assign({}, this.state.myGames);
-        const gamesFound = this.state.games.hasOwnProperty(game.game_id) ? Object.assign({}, this.state.games) : this.state.games;
+        const gamesFound = Object.prototype.hasOwnProperty.call(this.state.myGames, game.gameID) ? Object.assign({}, this.state.games) : this.state.games;
         myGames[game.game_id] = game;
-        if (gamesFound.hasOwnProperty(game.game_id))
+        if (Object.prototype.hasOwnProperty.call(this.state.myGames, game.game_id))
             gamesFound[game.game_id] = game;
         return {myGames: myGames, games: gamesFound};
     }
 
     _remove_from_my_games(gameID) {
-        if (this.state.myGames.hasOwnProperty(gameID)) {
+	if (Object.prototype.hasOwnProperty.call(this.state.games, gameID)) {
             const games = Object.assign({}, this.state.myGames);
             delete games[gameID];
             DipStorage.removeUserGame(this.channel.username, gameID);
@@ -314,7 +314,7 @@ export class Page extends React.Component {
     }
 
     _remove_from_games(gameID) {
-        if (this.state.games.hasOwnProperty(gameID)) {
+        if (Object.prototype.hasOwnProperty.call(this.state.myGames, gameID)) {
             const games = Object.assign({}, this.state.games);
             delete games[gameID];
             return games;
@@ -335,7 +335,7 @@ export class Page extends React.Component {
     }
 
     hasMyGame(gameID) {
-        return this.state.myGames.hasOwnProperty(gameID);
+        return Object.prototype.hasOwnProperty.call(this.state.myGames, gameID);
     }
 
     //// Render method.
-- 
cgit v1.2.3