ozserver
Version:
API for OZ
38 lines (35 loc) • 1.42 kB
JavaScript
var actions;
actions = require(global.home + '/script/controllers/actions')();
module.exports = function(streak) {
streak.on('feed.post', function(data) {
var _ref, _ref1;
if ((data != null ? data.aid : void 0) != null) {
return actions.set(data.aid, {
message: 'feed.post',
success: ((_ref = data.model) != null ? _ref.success : void 0) != null ? data.model.success : null,
notice: ((_ref1 = data.model) != null ? _ref1.notice : void 0) != null ? data.model.notice : null
});
}
});
streak.on('feed.edit', function(data) {
var _ref, _ref1;
if ((data != null ? data.aid : void 0) != null) {
return actions.set(data.aid, {
message: 'feed.edit',
success: ((_ref = data.model) != null ? _ref.success : void 0) != null ? data.model.success : null,
notice: ((_ref1 = data.model) != null ? _ref1.notice : void 0) != null ? data.model.notice : null
});
}
});
return streak.on('feed.upload', function(data) {
var _ref, _ref1;
if ((data != null ? data.aid : void 0) != null) {
return actions.set(data.aid, {
message: 'feed.upload',
success: ((_ref = data.file) != null ? _ref.error : void 0) != null ? false : true,
notice: ((_ref1 = data.file) != null ? _ref1.error : void 0) != null ? data.file.error : null,
file: data.file != null ? data.file : null
});
}
});
};