Skip to content

Commit

Permalink
Making game public when the summary is sent (everybody shall see all …
Browse files Browse the repository at this point in the history
…pics)
  • Loading branch information
ancasicolica committed Oct 18, 2023
1 parent 493af41 commit 9e74f95
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog Ferropoly Editor

* makeGameplayPublic in GameplayModel added

## v3.3.3 6.10.23
* Release Candidate 1
* Bugfix Microsoft Login
Expand Down
12 changes: 12 additions & 0 deletions common/models/gameplayModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,17 @@ async function getAutopilotGameplays() {
.exec();
}

/**
* Makes a gameplay public, which is after the game
* @param gameId
* @return {Promise<void>}
*/
async function makeGameplayPublic(gameId) {
let gp = await Gameplay.findOne({'internal.gameId': gameId}).exec();
gp.internal.gameDataPublic = true;
await gp.save();
return gp;
}

/**
* Exports of this module
Expand Down Expand Up @@ -745,6 +756,7 @@ module.exports = {
invalidatePricelist : invalidatePricelist,
updateGameplayPartial : updateGameplayPartial,
getAutopilotGameplays : getAutopilotGameplays,
makeGameplayPublic : makeGameplayPublic,
// Constants
MOBILE_NONE : MOBILE_NONE,
MOBILE_BASIC: MOBILE_BASIC,
Expand Down
7 changes: 7 additions & 0 deletions test/unit/common/models/gameplayModelTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,14 @@ describe('GameplayModel Tests', function () {
done(err);
});
});
});

describe('Making a GP public', function() {
it ('should mark the public flag', async function () {
let gp = await gameplays.makeGameplayPublic(gp1.internal.gameId)
expect(gp.internal.gameDataPublic).to.be(true);
return true;
})
});

describe('Deleting all gameplays again', function () {
Expand Down

0 comments on commit 9e74f95

Please sign in to comment.