Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Commit 45b014b

Browse files
authored
Merge pull request #44 from SpringRoll/161-fixes
1.6.1 fixes
2 parents 80f79c9 + eada4bd commit 45b014b

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

app/models/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ UserSchema.virtual('privilege').get(function()
100100
if (this.groups)
101101
{
102102
var privileges = this.groups.map(group => group.privilege);
103-
var highestPriority = Math.max(privileges);
103+
var highestPriority = Math.max.apply(Math, privileges);
104104
if (highestPriority)
105105
{
106106
return highestPriority;

app/routes/releases/release.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ router.delete('/:commit_id', function(req, res)
6363
return handleError(err);
6464
}
6565
req.flash('success', 'Deleted release');
66-
let release = await Release.getByCommitId(req.body.commitId);
67-
let game = await Game.getById(release.game);
66+
let game = await Game.getBySlug(req.body.game);
6867
let baseUrl = '';
6968
if (!game.isArchived){
7069
baseUrl = '/games';

app/views/games/release.jade

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ append gameContent
4242
.col-sm-9.col-sm-offset-3.text-center
4343
input(type="hidden" name="updatedBy" value=user._id)
4444
input(type="hidden" name="release" value=release._id)
45+
input(type="hidden" name="game" value=game.slug)
4546
button.btn.btn-lg.btn-primary(type="submit" name="action" value="PATCH") Update
4647
|
4748
button.btn.btn-lg.btn-danger(data-toggle="confirm" type="submit" name="action" value="DELETE") Delete

app/views/home.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ append content
1111
.row
1212
for game in games
1313
.col-md-3.col-sm-4.col-xs-6
14-
a.game(data-toggle="tooltip" title=game.title href="/games/game/#{game.slug}")
14+
a.game(data-toggle="tooltip" title=game.title href="/games/#{game.slug}")
1515
if game.thumbnail && game.thumbnail.length
1616
img.preview(src="data:image/png;base64,#{game.thumbnail}")
1717
else

scripts/updateArchived.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Load Environment
2+
const dotenv = require('dotenv');
3+
dotenv.load();
4+
5+
var mongoose = require('mongoose');
6+
7+
// Attempt to connect to database
8+
mongoose.connect(process.env.MONGO_DATABASE, function()
9+
{
10+
console.log('Connected to db.');
11+
mongoose.connection.db.collection('games').update(
12+
{},
13+
{$set: {
14+
isArchived: false
15+
}
16+
},
17+
{multi: true}
18+
);
19+
console.log('Active games have been updated.');
20+
mongoose.connection.db.collection('gamearchives').find({}).forEach(game => {
21+
game.isArchived = true;
22+
mongoose.connection.db.collection('games').insert(game);
23+
});
24+
console.log('Archived games transferred.');
25+
return;
26+
});

0 commit comments

Comments
 (0)