MCPcopy Create free account
hub / github.com/codecombat/codecombat / sendContactMessage

Function sendContactMessage

app/core/contact.js:10–32  ·  view source on GitHub ↗
(contactMessageObject, modal)

Source from the content-addressed store, hash-verified

8 */
9module.exports = {
10 sendContactMessage (contactMessageObject, modal) {
11 // deprecated
12 if (modal != null) {
13 modal.find('.sending-indicator').show()
14 }
15 const jqxhr = $.post('/contact', contactMessageObject, function (response) {
16 if (!modal) { return }
17 modal.find('.sending-indicator').hide()
18 modal.find('#contact-message').val('Thanks!')
19 return _.delay(function () {
20 modal.find('#contact-message').val('')
21 return modal.modal('hide')
22 }
23 , 1000)
24 })
25 jqxhr.fail(function () {
26 if (!modal) { return }
27 if (jqxhr.status === 500) {
28 return modal.find('.sending-indicator').text($.i18n.t('loading_error.server_error'))
29 }
30 })
31 return jqxhr
32 },
33
34 send (options) {
35 if (options == null) { options = {} }

Callers 3

contactMethod · 0.85
levelSubmitMethod · 0.85
contactMethod · 0.85

Calls 2

failMethod · 0.80
hideMethod · 0.45

Tested by

no test coverage detected