Skip to content

Commit 77592dd

Browse files
committed
Update Gist condition to check owner
1 parent 3ffcd60 commit 77592dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: public/local.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,15 @@ function handleTurnChange (turnData) {
299299
if (socket.id === previousPlayerId && turnData.gist != null) {
300300
console.log("User's turn is about to end.");
301301

302-
// If the current player is about to change,
303-
if (currentPlayerId !== previousPlayerId) {
302+
// If the current player does NOT own the current Gist,
303+
if (userName !== turnData.gist.owner) {
304304

305305
//console.log("handleTurnChange: now forking and editing gist " + turnData.gist.id);
306306

307-
// fork and edit the current gist on behalf of previous player and send new ID to server
307+
// Fork/edit current Gist on behalf of player whose turn is about to end, and send new ID to server
308308
forkAndEditGist(turnData.gist.id, editor.getValue());
309309

310-
// Otherwise, JUST EDIT the current gist on behalf of previous player and send new ID to server
310+
// Otherwise, JUST EDIT the current Gist and send new ID to server
311311
} else {
312312

313313
//console.log("handleTurnChange: now editing gist " + turnData.gist.id);

0 commit comments

Comments
 (0)