removed api: from client side socket calls

This commit is contained in:
Baris Soner Usakli
2014-01-16 15:10:37 -05:00
parent 4184574164
commit 67799eac95
26 changed files with 125 additions and 125 deletions

View File

@@ -13,7 +13,7 @@ define(['taskbar', 'string'], function(taskbar, S) {
return;
}
socket.emit('api:modules.chats.list', function(chats) {
socket.emit('modules.chats.list', function(chats) {
var chatsFrag = document.createDocumentFragment(),
chatEl = document.createElement('li'),
numChats = chats.length,
@@ -90,7 +90,7 @@ define(['taskbar', 'string'], function(taskbar, S) {
}
function checkStatus(chatModal, callback) {
socket.emit('api:user.isOnline', chatModal.touid, function(data) {
socket.emit('user.isOnline', chatModal.touid, function(data) {
if(data.online !== chatModal.online) {
if(data.online) {
module.appendChatMessage(chatModal, chatModal.username + ' is currently online.\n', data.timestamp);
@@ -191,7 +191,7 @@ define(['taskbar', 'string'], function(taskbar, S) {
}
function getChatMessages(chatModal, callback) {
socket.emit('api:modules.chats.get', {touid:chatModal.touid}, function(messages) {
socket.emit('modules.chats.get', {touid:chatModal.touid}, function(messages) {
for(var i = 0; i<messages.length; ++i) {
module.appendChatMessage(chatModal, messages[i].content, messages[i].timestamp);
}
@@ -218,7 +218,7 @@ define(['taskbar', 'string'], function(taskbar, S) {
var msg = S(chatModal.find('#chat-message-input').val()).stripTags().s;
if(msg.length) {
msg = msg +'\n';
socket.emit('api:modules.chats.send', { touid:chatModal.touid, message:msg});
socket.emit('modules.chats.send', { touid:chatModal.touid, message:msg});
chatModal.find('#chat-message-input').val('');
}
}

View File

@@ -45,7 +45,7 @@ define(['taskbar'], function(taskbar) {
composer.editPost = function(pid) {
if(allowed()) {
socket.emit('api:modules.composer.push', {
socket.emit('modules.composer.push', {
pid: pid
}, function(threadData) {
push({
@@ -108,7 +108,7 @@ define(['taskbar'], function(taskbar) {
} else if (parseInt(postData.pid) > 0) {
titleEl.val(postData.title);
titleEl.prop('readOnly', true);
socket.emit('api:modules.composer.editCheck', postData.pid, function(editCheck) {
socket.emit('modules.composer.editCheck', postData.pid, function(editCheck) {
if (editCheck.titleEditable) {
postContainer.find('input').prop('readonly', false);
}
@@ -434,7 +434,7 @@ define(['taskbar'], function(taskbar) {
// Still here? Let's post.
if (parseInt(postData.cid) > 0) {
socket.emit('api:topics.post', {
socket.emit('topics.post', {
'title' : titleEl.val(),
'content' : bodyEl.val(),
'category_id' : postData.cid
@@ -442,14 +442,14 @@ define(['taskbar'], function(taskbar) {
composer.discard(post_uuid);
});
} else if (parseInt(postData.tid) > 0) {
socket.emit('api:posts.reply', {
socket.emit('posts.reply', {
'topic_id' : postData.tid,
'content' : bodyEl.val()
}, function() {
composer.discard(post_uuid);
});
} else if (parseInt(postData.pid) > 0) {
socket.emit('api:posts.edit', {
socket.emit('posts.edit', {
pid: postData.pid,
content: bodyEl.val(),
title: titleEl.val()
@@ -568,12 +568,12 @@ define(['taskbar'], function(taskbar) {
dropDiv.hide();
if(file.type.match('image.*')) {
uploadFile('api:posts.uploadImage', post_uuid, fileData);
uploadFile('posts.uploadImage', post_uuid, fileData);
} else {
if(file.size > parseInt(config.maximumFileSize, 10) * 1024) {
return composerAlert('File too big', 'Maximum allowed file size is ' + config.maximumFileSize + 'kbs');
}
uploadFile('api:posts.uploadFile', post_uuid, fileData);
uploadFile('posts.uploadFile', post_uuid, fileData);
}
});
@@ -582,7 +582,7 @@ define(['taskbar'], function(taskbar) {
function uploadFile(method, post_uuid, img) {
var linkStart = method === 'api:posts.uploadImage' ? '!' : '',
var linkStart = method === 'posts.uploadImage' ? '!' : '',
postContainer = $('#cmp-uuid-' + post_uuid),
textarea = postContainer.find('textarea'),
text = textarea.val(),

View File

@@ -11,7 +11,7 @@ define(function() {
notifTrigger.addEventListener('click', function(e) {
e.preventDefault();
if (notifContainer.className.indexOf('open') === -1) {
socket.emit('api:notifications.get', null, function(data) {
socket.emit('notifications.get', null, function(data) {
var notifFrag = document.createDocumentFragment(),
notifEl = document.createElement('li'),
numRead = data.read.length,
@@ -51,7 +51,7 @@ define(function() {
notifIcon.toggleClass('active', false);
}
socket.emit('api:modules.notifications.mark_all_read', null, function() {
socket.emit('modules.notifications.mark_all_read', null, function() {
notifIcon.toggleClass('active', false);
app.refreshTitle();
@@ -78,7 +78,7 @@ define(function() {
}
if (target) {
var nid = parseInt(target.getAttribute('data-nid'));
if (nid > 0) socket.emit('api:modules.notifications.mark_read', nid);
if (nid > 0) socket.emit('modules.notifications.mark_read', nid);
}
});
@@ -95,7 +95,7 @@ define(function() {
localStorage.setItem('notifications:count', count);
};
socket.emit('api:notifications.getCount', function(err, count) {
socket.emit('notifications.getCount', function(err, count) {
if (!err) {
updateNotifCount(count);
} else {