mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Merge pull request #3330 from differentmatt/teacher-news
Add approved teacher trials to CodoCombat list Teachers group
This commit is contained in:
commit
c23fb50fa7
7 changed files with 34 additions and 6 deletions
|
@ -1037,6 +1037,7 @@
|
||||||
ambassador_title: "Ambassador"
|
ambassador_title: "Ambassador"
|
||||||
ambassador_title_description: "(Support)"
|
ambassador_title_description: "(Support)"
|
||||||
ambassador_summary: "Tame our forum users and provide direction for those with questions. Our ambassadors represent CodeCombat to the world."
|
ambassador_summary: "Tame our forum users and provide direction for those with questions. Our ambassadors represent CodeCombat to the world."
|
||||||
|
teacher_title: "Teacher"
|
||||||
|
|
||||||
editor:
|
editor:
|
||||||
main_title: "CodeCombat Editors"
|
main_title: "CodeCombat Editors"
|
||||||
|
@ -1193,6 +1194,7 @@
|
||||||
ambassador_join_note_strong: "Note"
|
ambassador_join_note_strong: "Note"
|
||||||
ambassador_join_note_desc: "One of our top priorities is to build multiplayer where players having difficulty solving levels can summon higher level wizards to help them. This will be a great way for ambassadors to do their thing. We'll keep you posted!"
|
ambassador_join_note_desc: "One of our top priorities is to build multiplayer where players having difficulty solving levels can summon higher level wizards to help them. This will be a great way for ambassadors to do their thing. We'll keep you posted!"
|
||||||
ambassador_subscribe_desc: "Get emails on support updates and multiplayer developments."
|
ambassador_subscribe_desc: "Get emails on support updates and multiplayer developments."
|
||||||
|
teacher_subscribe_desc: "Get emails on updates and announcements for teachers."
|
||||||
changes_auto_save: "Changes are saved automatically when you toggle checkboxes."
|
changes_auto_save: "Changes are saved automatically when you toggle checkboxes."
|
||||||
diligent_scribes: "Our Diligent Scribes:"
|
diligent_scribes: "Our Diligent Scribes:"
|
||||||
powerful_archmages: "Our Powerful Archmages:"
|
powerful_archmages: "Our Powerful Archmages:"
|
||||||
|
|
|
@ -79,6 +79,7 @@ _.extend UserSchema.properties,
|
||||||
archmageNews: {$ref: '#/definitions/emailSubscription'}
|
archmageNews: {$ref: '#/definitions/emailSubscription'}
|
||||||
artisanNews: {$ref: '#/definitions/emailSubscription'}
|
artisanNews: {$ref: '#/definitions/emailSubscription'}
|
||||||
diplomatNews: {$ref: '#/definitions/emailSubscription'}
|
diplomatNews: {$ref: '#/definitions/emailSubscription'}
|
||||||
|
teacherNews: {$ref: '#/definitions/emailSubscription'}
|
||||||
scribeNews: {$ref: '#/definitions/emailSubscription'}
|
scribeNews: {$ref: '#/definitions/emailSubscription'}
|
||||||
|
|
||||||
# notifications
|
# notifications
|
||||||
|
|
|
@ -159,7 +159,7 @@ else
|
||||||
| (Translator)
|
| (Translator)
|
||||||
input#email_diplomatNews(name="email_diplomatNews", type="checkbox", checked=subs.diplomatNews)
|
input#email_diplomatNews(name="email_diplomatNews", type="checkbox", checked=subs.diplomatNews)
|
||||||
span(data-i18n="contribute.diplomat_subscribe_desc").help-block Get emails about i18n developments and, eventually, levels to translate.
|
span(data-i18n="contribute.diplomat_subscribe_desc").help-block Get emails about i18n developments and, eventually, levels to translate.
|
||||||
|
|
||||||
.form-group.checkbox
|
.form-group.checkbox
|
||||||
label.control-label(for="email_ambassadorNews")
|
label.control-label(for="email_ambassadorNews")
|
||||||
span(data-i18n="classes.ambassador_title")
|
span(data-i18n="classes.ambassador_title")
|
||||||
|
@ -169,7 +169,13 @@ else
|
||||||
| (Support)
|
| (Support)
|
||||||
input#email_ambassadorNews(name="email_ambassadorNews", type="checkbox", checked=subs.ambassadorNews)
|
input#email_ambassadorNews(name="email_ambassadorNews", type="checkbox", checked=subs.ambassadorNews)
|
||||||
span(data-i18n="contribute.ambassador_subscribe_desc").help-block Get emails on support updates and multiplayer developments.
|
span(data-i18n="contribute.ambassador_subscribe_desc").help-block Get emails on support updates and multiplayer developments.
|
||||||
|
|
||||||
|
.form-group.checkbox
|
||||||
|
label.control-label(for="email_teacherNews")
|
||||||
|
span(data-i18n="classes.teacher_title")
|
||||||
|
input#email_teacherNews(name="email_teacherNews", type="checkbox", checked=subs.teacherNews)
|
||||||
|
span(data-i18n="contribute.teacher_subscribe_desc").help-block
|
||||||
|
|
||||||
button#toggle-all-btn.btn.btn-primary.form-control(data-i18n="account_settings.email_toggle") Toggle All
|
button#toggle-all-btn.btn.btn-primary.form-control(data-i18n="account_settings.email_toggle") Toggle All
|
||||||
|
|
||||||
.panel.panel-default
|
.panel.panel-default
|
||||||
|
|
|
@ -3,6 +3,6 @@ config = require '../../server_config'
|
||||||
module.exports.MAILCHIMP_LIST_ID = 'e9851239eb'
|
module.exports.MAILCHIMP_LIST_ID = 'e9851239eb'
|
||||||
module.exports.MAILCHIMP_GROUP_ID = '4529'
|
module.exports.MAILCHIMP_GROUP_ID = '4529'
|
||||||
|
|
||||||
# these two need to be parallel
|
# These two need to be parallel
|
||||||
module.exports.MAILCHIMP_GROUPS = ['Announcements', 'Adventurers', 'Artisans', 'Archmages', 'Scribes', 'Diplomats', 'Ambassadors']
|
module.exports.MAILCHIMP_GROUPS = ['Announcements', 'Adventurers', 'Artisans', 'Archmages', 'Scribes', 'Diplomats', 'Ambassadors', 'Teachers']
|
||||||
module.exports.NEWS_GROUPS = ['generalNews', 'adventurerNews', 'artisanNews', 'archmageNews', 'scribeNews', 'diplomatNews', 'ambassadorNews']
|
module.exports.NEWS_GROUPS = ['generalNews', 'adventurerNews', 'artisanNews', 'archmageNews', 'scribeNews', 'diplomatNews', 'ambassadorNews', 'teacherNews']
|
||||||
|
|
|
@ -5,6 +5,7 @@ hipchat = require '../hipchat'
|
||||||
sendwithus = require '../sendwithus'
|
sendwithus = require '../sendwithus'
|
||||||
Prepaid = require '../prepaids/Prepaid'
|
Prepaid = require '../prepaids/Prepaid'
|
||||||
jsonSchema = require '../../app/schemas/models/trial_request.schema'
|
jsonSchema = require '../../app/schemas/models/trial_request.schema'
|
||||||
|
User = require '../users/User'
|
||||||
|
|
||||||
TrialRequestSchema = new mongoose.Schema {}, {strict: false, minimize: false, read:config.mongo.readpref}
|
TrialRequestSchema = new mongoose.Schema {}, {strict: false, minimize: false, read:config.mongo.readpref}
|
||||||
|
|
||||||
|
@ -32,6 +33,19 @@ TrialRequestSchema.post 'save', (doc) ->
|
||||||
sendwithus.api.send emailParams, (err, result) =>
|
sendwithus.api.send emailParams, (err, result) =>
|
||||||
log.error "sendwithus trial request approved error: #{err}, result: #{result}" if err
|
log.error "sendwithus trial request approved error: #{err}, result: #{result}" if err
|
||||||
|
|
||||||
|
# Subscribe to teacher news group
|
||||||
|
User.findById doc.get('applicant'), (err, user) =>
|
||||||
|
if err
|
||||||
|
log.error "Trial request user find error: #{err}"
|
||||||
|
return
|
||||||
|
emails = _.cloneDeep(user.get('emails') ? {})
|
||||||
|
emails.teacherNews ?= {}
|
||||||
|
emails.teacherNews.enabled = true
|
||||||
|
user.update {$set: {emails: emails}}, {}, (err) =>
|
||||||
|
if err
|
||||||
|
log.error "Trial request user update error: #{err}"
|
||||||
|
return
|
||||||
|
|
||||||
TrialRequestSchema.statics.privateProperties = []
|
TrialRequestSchema.statics.privateProperties = []
|
||||||
TrialRequestSchema.statics.editableProperties = [
|
TrialRequestSchema.statics.editableProperties = [
|
||||||
'created'
|
'created'
|
||||||
|
|
|
@ -76,6 +76,7 @@ emailNameMap =
|
||||||
diplomatNews: 'translator'
|
diplomatNews: 'translator'
|
||||||
ambassadorNews: 'support'
|
ambassadorNews: 'support'
|
||||||
anyNotes: 'notification'
|
anyNotes: 'notification'
|
||||||
|
teacherNews: 'teacher'
|
||||||
|
|
||||||
UserSchema.methods.setEmailSubscription = (newName, enabled) ->
|
UserSchema.methods.setEmailSubscription = (newName, enabled) ->
|
||||||
oldSubs = _.clone @get('emailSubscriptions')
|
oldSubs = _.clone @get('emailSubscriptions')
|
||||||
|
|
|
@ -134,7 +134,11 @@ describe 'Trial Requests', ->
|
||||||
expect(prepaid.get('type')).toEqual('course')
|
expect(prepaid.get('type')).toEqual('course')
|
||||||
expect(prepaid.get('creator')).toEqual(user.get('_id'))
|
expect(prepaid.get('creator')).toEqual(user.get('_id'))
|
||||||
expect(prepaid.get('maxRedeemers')).toEqual(2)
|
expect(prepaid.get('maxRedeemers')).toEqual(2)
|
||||||
done()
|
User.findById user._id, (err, user) =>
|
||||||
|
expect(err).toBeNull()
|
||||||
|
return done(err) if err
|
||||||
|
expect(user.get('emails')?.teacherNews?.enabled).toEqual(true)
|
||||||
|
done()
|
||||||
|
|
||||||
it 'Deny trial request', (done) ->
|
it 'Deny trial request', (done) ->
|
||||||
loginNewUser (user) ->
|
loginNewUser (user) ->
|
||||||
|
|
Loading…
Reference in a new issue