Merge branch 'master' into production

This commit is contained in:
Nick Winter 2014-08-15 10:51:04 -07:00
commit 7f2366591a
5 changed files with 7 additions and 4 deletions

View file

@ -6,6 +6,7 @@ PatchSchema = c.object({title: 'Patch', required: ['target', 'delta', 'commitMes
delta: {title: 'Delta', type: ['array', 'object']}
commitMessage: c.shortString({maxLength: 500, minLength: 1})
creator: c.objectId(links: [{rel: 'extra', href: '/db/user/{($)}'}])
acceptor: c.objectId(links: [{rel: 'extra', href: '/db/user/{($)}'}])
created: c.date({title: 'Created', readOnly: true})
status: {enum: ['pending', 'accepted', 'rejected', 'withdrawn']}

View file

@ -79,7 +79,7 @@ module.exports = class LevelEditView extends RootView
@insertSubView new ComponentsTabView supermodel: @supermodel
@insertSubView new SystemsTabView supermodel: @supermodel
@insertSubView new RelatedAchievementsView supermodel: @supermodel, level: @level
@insertSubView new ComponentDocsView supermodel: @supermodel
@insertSubView new ComponentDocsView # Don't give it the supermodel, it'll pollute it!
Backbone.Mediator.publish 'level-loaded', level: @level
@showReadOnly() if me.get('anonymous')

View file

@ -53,9 +53,10 @@ PatchHandler = class PatchHandler extends Handler
# Only increment statistics upon very first accept
if patch.isNewlyAccepted()
accepter = req.user.get 'id'
patch.set 'acceptor', req.user.get('id')
acceptor = req.user.get 'id'
submitter = patch.get 'creator'
User.incrementStat accepter, 'stats.patchesAccepted'
User.incrementStat acceptor, 'stats.patchesAccepted'
# TODO maybe merge these increments together
if patch.isTranslationPatch()
User.incrementStat submitter, 'stats.totalTranslationPatches'

View file

@ -232,7 +232,7 @@ UserHandler = class UserHandler extends Handler
IDify: (idOrSlug, done) ->
return done null, idOrSlug if Handler.isID idOrSlug
User.getBySlug idOrSlug, (err, user) -> done err, user?.get '_id'
User.findBySlug idOrSlug, (err, user) -> done err, user?.get '_id'
getLevelSessions: (req, res, userIDOrSlug) ->
@IDify userIDOrSlug, (err, userID) =>

View file

@ -111,6 +111,7 @@ describe '/db/patch', ->
expect(res.statusCode).toBe(200)
Patch.findOne({}).exec (err, article) ->
expect(article.get('status')).toBe 'accepted'
expect(article.get('acceptor')).toBeDefined()
done()
it 'keeps track of amount of submitted and accepted patches', (done) ->