removing openbadger hooks as it's definied elsewhere now. merge conflict

This commit is contained in:
Chris McAvoy 2013-06-17 14:00:09 -05:00
Родитель db60a9d742 2646008523
Коммит 944242ebc4
6 изменённых файлов: 36 добавлений и 42 удалений

Просмотреть файл

@ -79,7 +79,7 @@ module.exports = function (app) {
return activityPage(req, res, next,
req.params.learnerName,
req.params.dependants,
{badge: true, applications: true}
{badges: true, applications: true}
);
});
@ -269,7 +269,7 @@ module.exports = function (app) {
});
});
app.post('/dashboard/:learnerName/applications/:applicationId', [isGuardian], function (req, res, next) {
app.post('/dashboard/:learnerName/applications/:badgeId', [isGuardian], function (req, res, next) {
var learnerName = req.params.learnerName,
badgeId = req.params.badgeId,
action = req.body.action,

Просмотреть файл

@ -1,12 +1,13 @@
const jwt = require('jwt-simple');
const util = require('util');
var db = require('../db');
const db = require('../db');
const learners = db.model('Learner');
const guardians = db.model('Guardian');
const mandrill = require('../mandrill');
const openbadger = require('../openbadger');
const url = require('url');
const logger = require('../logger');
const s3 = require('../s3');
const JWT_SECRET = process.env.CSOL_OPENBADGER_SECRET;
const CSOL_HOST = process.env.CSOL_HOST;
@ -126,5 +127,19 @@ module.exports = function (app) {
};
module.exports.testHandler = function(req, res, next) {
return res.send(501, 'test handler not implemented');
var claimCode = req.body.claimCode;
if (req.body.isTesting !== true)
return res.send(200, "body.isTesting !== true");
if (!(claimCode && typeof(claimCode) == "string"))
return res.send(200, "body.claimCode is empty");
s3.putBuffer(new Buffer(claimCode), '/' + claimCode, {
'Content-Type': 'text/plain'
}, function(err) {
if (err) return res.send(200, "s3 putbuffer failed");
return res.send(200, "S3_ITEM_CREATED");
});
};

Просмотреть файл

@ -138,7 +138,7 @@ module.exports = {
badgeName: data.badge.name,
approvalUrl: approvalUrl
}, guardian.email, function (err) {
if (err)
if (err && err !== 'EMAIL DISABLED')
return callback(err);
application.updateAttributes({ state: 'waiting' }).complete(callback);

Просмотреть файл

@ -215,8 +215,6 @@ module.exports = {
if (err)
return callback(err);
console.log(badges);
callback(null, _.flatten(badges));
});
}
@ -232,8 +230,8 @@ module.exports = {
activities = _.flatten(activities);
if (options.badges) {
applications = _.reject(applications, function(application) {
return application.state === 'accepted';
activities = _.reject(activities, function(activity) {
return activity.state === 'accepted';
});
}

Просмотреть файл

@ -4,7 +4,6 @@ const _ = require('underscore');
const jwt = require('jwt-simple');
const async = require('async');
const s3 = require('./s3');
const openbadgerHooks = require('./controllers/openbadger-hooks');
const ENDPOINT = process.env['CSOL_OPENBADGER_URL'];
const JWT_SECRET = process.env['CSOL_OPENBADGER_SECRET'];
@ -475,21 +474,3 @@ module.exports.healthCheck = function(meta, cb) {
function(_, done) { meta.webhookTest = "OK"; done(); }
], cb);
};
openbadgerHooks.testHandler = function(req, res, next) {
var claimCode = req.body.claimCode;
if (req.body.isTesting !== true)
return res.send(200, "body.isTesting !== true");
if (!(claimCode && typeof(claimCode) == "string"))
return res.send(200, "body.claimCode is empty");
s3.putBuffer(new Buffer(claimCode), '/' + claimCode, {
'Content-Type': 'text/plain'
}, function(err) {
if (err) return res.send(200, "s3 putbuffer failed");
return res.send(200, "S3_ITEM_CREATED");
});
};

Просмотреть файл

@ -9,7 +9,7 @@
</li>
{% for dependant in dependants %}
<li{% if dependant.username == current.username %} class="active"{% endif %}>
<a href="/dashboard/{{ dependant.username }}">{{ dependant.getDisplayName() }}</a>
<a href="/dashboard/{{ dependant.username }}">{{ dependant.getDisplayName() }}</a>
</li>
{% endfor %}
{% endblock %}
@ -20,19 +20,19 @@
{% block content %}
{% block activity %}
{% for current in dependants %}
<h3>{{ current.getDisplayName() }}'s recent activity</h3>
{% if current.activities.length %}
<ul class="activity thumbnails">
{% for activity in current.activities %}
<li class="span3">
{% include "includes/learner-activity.html" %}
</li>
{% endfor %}
</ul>
{% else %}
<p>{{ current.getDisplayName() }} does not have any recent activity.</p>
{% endif %}
<p class="text-right"><a href="/dashboard/{{ dependant.username }}" class="btn">See all activity &raquo;</a></p>
<h3>{{ current.getDisplayName() }}'s recent activity</h3>
{% if current.activities.length %}
<ul class="activity thumbnails">
{% for activity in current.activities %}
<li class="span3">
{% include "includes/learner-activity.html" %}
</li>
{% endfor %}
</ul>
{% else %}
<p>{{ current.getDisplayName() }} does not have any recent activity.</p>
{% endif %}
<p class="text-right"><a href="/dashboard/{{ current.username }}" class="btn">See all activity &raquo;</a></p>
{% endfor %}
{% endblock %}
{% endblock %}