mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Add approved date to job profile
This commit is contained in:
parent
87a24d3c48
commit
bb3c583300
4 changed files with 7 additions and 2 deletions
|
@ -46,6 +46,10 @@ module.exports = class User extends CocoModel
|
|||
)
|
||||
cache[id] = user
|
||||
user
|
||||
set: ->
|
||||
if arguments[0] is 'jobProfileApproved' and @get("jobProfileApproved") is false and not @get("jobProfileApprovedDate")
|
||||
@set "jobProfileApprovedDate", (new Date()).toISOString()
|
||||
super arguments...
|
||||
|
||||
# callbacks can be either success or error
|
||||
@getByIDOrSlug: (idOrSlug, force, callbacks={}) ->
|
||||
|
|
|
@ -156,6 +156,7 @@ _.extend UserSchema.properties,
|
|||
type: 'boolean'
|
||||
description: 'Should this candidate be prominently featured on the site?'
|
||||
jobProfileApproved: {title: 'Job Profile Approved', type: 'boolean', description: 'Whether your profile has been approved by CodeCombat.'}
|
||||
jobProfileApprovedDate: c.date {title: 'Approved date', description: 'The date that the candidate was approved'}
|
||||
jobProfileNotes: {type: 'string', maxLength: 1000, title: 'Our Notes', description: 'CodeCombat\'s notes on the candidate.', format: 'markdown', default: ''}
|
||||
employerAt: c.shortString {description: 'If given employer permissions to view job candidates, for which employer?'}
|
||||
signedEmployerAgreement: c.object {},
|
||||
|
|
|
@ -322,7 +322,7 @@ module.exports = class ProfileView extends View
|
|||
return unless me.isAdmin()
|
||||
approved = not @user.get 'jobProfileApproved'
|
||||
@user.set 'jobProfileApproved', approved
|
||||
res = @user.save {jobProfileApproved: approved}, {patch: true}
|
||||
res = @user.patch()
|
||||
res.success (model, response, options) => @render()
|
||||
|
||||
toggleJobProfileActive: ->
|
||||
|
|
|
@ -35,7 +35,7 @@ UserHandler = class UserHandler extends Handler
|
|||
getEditableProperties: (req, document) ->
|
||||
props = super req, document
|
||||
props.push 'permissions' unless config.isProduction
|
||||
props.push 'jobProfileApproved', 'jobProfileNotes' if req.user.isAdmin() # Admins naturally edit these
|
||||
props.push 'jobProfileApproved', 'jobProfileNotes','jobProfileApprovedDate' if req.user.isAdmin() # Admins naturally edit these
|
||||
props.push privateProperties... if req.user.isAdmin() # Admins are mad with power
|
||||
props
|
||||
|
||||
|
|
Loading…
Reference in a new issue