removed api: from client side socket calls

v1.18.x
Baris Soner Usakli 11 years ago
parent 4184574164
commit 67799eac95

@ -36,7 +36,7 @@ var socket,
app.uid = data.uid;
app.showLoginMessage();
socket.emit('api:meta.updateHeader', {
socket.emit('meta.updateHeader', {
fields: ['username', 'picture', 'userslug']
}, app.updateHeader);
});
@ -77,14 +77,14 @@ var socket,
}
app.enterRoom(room, true);
socket.emit('api:meta.reconnected');
socket.emit('meta.reconnected');
setTimeout(function() {
reconnectEl.removeClass('active').addClass("hide");
}, 3000);
}
socket.emit('api:meta.updateHeader', {
socket.emit('meta.updateHeader', {
fields: ['username', 'picture', 'userslug']
}, app.updateHeader);
});
@ -235,7 +235,7 @@ var socket,
return;
}
socket.emit('api:meta.rooms.enter', {
socket.emit('meta.rooms.enter', {
'enter': room,
'leave': app.currentRoom
});
@ -251,7 +251,7 @@ var socket,
uids.push(this.getAttribute('data-uid'));
});
socket.emit('api:user.get_online_users', uids, function (users) {
socket.emit('user.get_online_users', uids, function (users) {
jQuery('a.username-field').each(function () {
if (this.processed === true)
return;
@ -449,7 +449,7 @@ var socket,
url = a.pathname.slice(1);
}
socket.emit('api:meta.buildTitle', url, function(title, numNotifications) {
socket.emit('meta.buildTitle', url, function(title, numNotifications) {
titleObj.titles[0] = (numNotifications > 0 ? '(' + numNotifications + ') ' : '') + title;
app.alternatingTitle('');
});

@ -35,7 +35,7 @@ define(['forum/accountheader'], function(header) {
}
followBtn.on('click', function() {
socket.emit('api:user.follow', {
socket.emit('user.follow', {
uid: theirid
}, function(success) {
if (success) {
@ -50,7 +50,7 @@ define(['forum/accountheader'], function(header) {
});
unfollowBtn.on('click', function() {
socket.emit('api:user.unfollow', {
socket.emit('user.unfollow', {
uid: theirid
}, function(success) {
if (success) {
@ -72,9 +72,9 @@ define(['forum/accountheader'], function(header) {
ajaxify.go($(this).attr('topic-url'));
});
socket.on('api:user.isOnline', Account.handleUserOnline);
socket.on('user.isOnline', Account.handleUserOnline);
socket.emit('api:user.isOnline', theirid, Account.handleUserOnline);
socket.emit('user.isOnline', theirid, Account.handleUserOnline);
socket.on('event:new_post', function(data) {
var html = templates.prepare(templates['account'].blocks['posts']).parse(data);

@ -24,7 +24,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) {
signature: $('#inputSignature').val()
};
socket.emit('api:user.updateProfile', userData, function(err, data) {
socket.emit('user.updateProfile', userData, function(err, data) {
if (data.success) {
app.alertSuccess('Your profile has been updated successfully!');
if (data.picture) {
@ -108,7 +108,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) {
uploadedPicture = imageUrlOnServer;
socket.emit('api:meta.updateHeader', {
socket.emit('meta.updateHeader', {
fields: ['username', 'picture', 'userslug']
}, app.updateHeader);
});
@ -174,7 +174,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) {
$('#changePasswordBtn').on('click', function() {
if (passwordvalid && passwordsmatch && currentPassword.val()) {
socket.emit('api:user.changePassword', {
socket.emit('user.changePassword', {
'currentPassword': currentPassword.val(),
'newPassword': password.val()
}, function(err) {
@ -206,7 +206,7 @@ define(['forum/accountheader', 'uploader'], function(header, uploader) {
type: type
};
socket.emit('api:user.changePicture', userData, function(success) {
socket.emit('user.changePicture', userData, function(success) {
if (!success) {
app.alertError('There was an error changing picture!');
}

@ -10,7 +10,7 @@ define(['forum/accountheader'], function(header) {
showemail: $('#showemailCheckBox').is(':checked') ? 1 : 0
};
socket.emit('api:user.saveSettings', settings, function(err) {
socket.emit('user.saveSettings', settings, function(err) {
if (!err) {
app.alertSuccess('Settings saved!');
} else {

@ -13,7 +13,7 @@ define(['uploader'], function(uploader) {
}
function save() {
socket.emit('api:admin.categories.update', modified_categories);
socket.emit('admin.categories.update', modified_categories);
modified_categories = {};
}
@ -86,7 +86,7 @@ define(['uploader'], function(uploader) {
order: $('.admin-categories #entry-container').children().length + 1
};
socket.emit('api:admin.categories.create', category, function(err, data) {
socket.emit('admin.categories.create', category, function(err, data) {
if (!err) {
app.alert({
alert_id: 'category_created',
@ -223,7 +223,7 @@ define(['uploader'], function(uploader) {
clearTimeout(searchDelay);
searchDelay = setTimeout(function() {
socket.emit('api:admin.categories.search', {
socket.emit('admin.categories.search', {
username: searchEl.value,
cid: cid
}, function(err, results) {
@ -257,7 +257,7 @@ define(['uploader'], function(uploader) {
privilege = this.getAttribute('data-priv');
e.preventDefault();
socket.emit('api:admin.categories.setPrivilege', {
socket.emit('admin.categories.setPrivilege', {
cid: cid,
uid: uid,
privilege: privilege,
@ -275,7 +275,7 @@ define(['uploader'], function(uploader) {
});
// User Groups and privileges
socket.emit('api:admin.categories.groupsList', cid, function(err, results) {
socket.emit('admin.categories.groupsList', cid, function(err, results) {
var groupsFrag = document.createDocumentFragment(),
numResults = results.length,
trEl = document.createElement('tr'),
@ -303,7 +303,7 @@ define(['uploader'], function(uploader) {
gid = btnEl.parents('tr[data-gid]').attr('data-gid'),
privilege = this.getAttribute('data-gpriv');
e.preventDefault();
socket.emit('api:admin.categories.setGroupPrivilege', cid, gid, privilege, !btnEl.hasClass('active'), function(err) {
socket.emit('admin.categories.setGroupPrivilege', cid, gid, privilege, !btnEl.hasClass('active'), function(err) {
if (!err) {
btnEl.toggleClass('active');
}
@ -317,7 +317,7 @@ define(['uploader'], function(uploader) {
var modalEl = $('#category-permissions-modal'),
readMembers = modalEl.find('#category-permissions-read'),
writeMembers = modalEl.find('#category-permissions-write');
socket.emit('api:admin.categories.getPrivilegeSettings', cid, function(err, privilegeList) {
socket.emit('admin.categories.getPrivilegeSettings', cid, function(err, privilegeList) {
var readLength = privilegeList['+r'].length,
writeLength = privilegeList['+w'].length,
readFrag = document.createDocumentFragment(),

@ -15,6 +15,6 @@ jQuery('document').ready(function() {
}, false);
});
socket.emit('api:admin.config.get', function(config) {
socket.emit('admin.config.get', function(config) {
app.config = config;
});

@ -29,7 +29,7 @@ define(function() {
errorEl = $('#create-modal-error'),
errorText;
socket.emit('api:admin.groups.create', submitObj, function(err, data) {
socket.emit('admin.groups.create', submitObj, function(err, data) {
if (err) {
switch (err) {
case 'group-exists':
@ -63,14 +63,14 @@ define(function() {
case 'delete':
bootbox.confirm('Are you sure you wish to delete this group?', function(confirm) {
if (confirm) {
socket.emit('api:admin.groups.delete', gid, function(err, data) {
socket.emit('admin.groups.delete', gid, function(err, data) {
if (data === 'OK') ajaxify.go('admin/groups');
});
}
});
break;
case 'members':
socket.emit('api:admin.groups.get', gid, function(err, groupObj) {
socket.emit('admin.groups.get', gid, function(err, groupObj) {
var formEl = detailsModal.find('form'),
nameEl = formEl.find('#change-group-name'),
descEl = formEl.find('#change-group-desc'),
@ -120,7 +120,7 @@ define(function() {
foundUserImg = foundUser.getElementsByTagName('img')[0];
foundUserLabel = foundUser.getElementsByTagName('span')[0];
socket.emit('api:admin.user.search', searchText, function(err, results) {
socket.emit('admin.user.search', searchText, function(err, results) {
if (!err && results && results.length > 0) {
var numResults = results.length,
resultsSlug = document.createDocumentFragment(),
@ -152,7 +152,7 @@ define(function() {
});
if (members.indexOf(uid) === -1) {
socket.emit('api:admin.groups.join', {
socket.emit('admin.groups.join', {
gid: gid,
uid: uid
}, function(err, data) {
@ -167,7 +167,7 @@ define(function() {
var uid = this.getAttribute('data-uid'),
gid = detailsModal.attr('data-gid');
socket.emit('api:admin.groups.leave', {
socket.emit('admin.groups.leave', {
gid: gid,
uid: uid
}, function(err, data) {
@ -183,7 +183,7 @@ define(function() {
descEl = formEl.find('#change-group-desc'),
gid = detailsModal.attr('data-gid');
socket.emit('api:admin.groups.update', {
socket.emit('admin.groups.update', {
gid: gid,
values: {
name: nameEl.val(),

@ -2,10 +2,10 @@ define(function() {
var Admin = {};
Admin.init = function() {
ajaxify.register_events(['api:meta.rooms.getAll']);
ajaxify.register_events(['meta.rooms.getAll']);
app.enterRoom('admin');
socket.emit('api:meta.rooms.getAll', Admin.updateRoomUsage);
socket.emit('meta.rooms.getAll', Admin.updateRoomUsage);
socket.on('event:meta.rooms.update', Admin.updateRoomUsage);
$('#logout-link').on('click', function() {

@ -8,10 +8,10 @@ define(function() {
if (numPlugins > 0) {
pluginsList.on('click', 'button[data-action="toggleActive"]', function() {
pluginID = $(this).parents('li').attr('data-plugin-id');
socket.emit('api:admin.plugins.toggle', pluginID);
socket.emit('admin.plugins.toggle', pluginID);
});
socket.on('api:admin.plugins.toggle', function(status) {
socket.on('admin.plugins.toggle', function(status) {
pluginTgl = document.querySelector('.plugins li[data-plugin-id="' + status.id + '"] button');
pluginTgl.innerHTML = '<i class="fa fa-power-off"></i> ' + (status.active ? 'Dea' : 'A') + 'ctivate';

@ -70,7 +70,7 @@ define(['uploader'], function(uploader) {
value = fields[x].value;
}
socket.emit('api:admin.config.set', {
socket.emit('admin.config.set', {
key: key,
value: value
}, function(data) {
@ -119,7 +119,7 @@ define(['uploader'], function(uploader) {
};
Settings.remove = function(key) {
socket.emit('api:admin.config.remove', key);
socket.emit('admin.config.remove', key);
};
return Settings;

@ -23,7 +23,7 @@ define(function() {
cssSrc = parentEl.attr('data-css'),
themeId = parentEl.attr('data-theme');
socket.emit('api:admin.themes.set', {
socket.emit('admin.themes.set', {
type: themeType,
id: themeId,
src: cssSrc
@ -47,7 +47,7 @@ define(function() {
revertEl.addEventListener('click', function() {
bootbox.confirm('Are you sure you wish to remove the custom theme and restore the NodeBB default theme?', function(confirm) {
if (confirm) {
socket.emit('api:admin.themes.set', {
socket.emit('admin.themes.set', {
type: 'local',
id: 'nodebb-theme-cerulean'
}, function(err) {
@ -64,7 +64,7 @@ define(function() {
}, false);
// Installed Themes
socket.emit('api:admin.themes.getInstalled', function(themes) {
socket.emit('admin.themes.getInstalled', function(themes) {
var instListEl = document.getElementById('installed_themes'),
themeFrag = document.createDocumentFragment(),
liEl = document.createElement('li');

@ -15,11 +15,11 @@ define(function() {
switch (action) {
case 'pin':
if (!$this.hasClass('active')) {
socket.emit('api:topics.pin', {
socket.emit('topics.pin', {
tid: tid
}, Topics.pin);
} else {
socket.emit('api:topics.unpin', {
socket.emit('topics.unpin', {
tid: tid
}, Topics.unpin);
}
@ -27,11 +27,11 @@ define(function() {
case 'lock':
if (!$this.hasClass('active')) {
socket.emit('api:topics.lock', {
socket.emit('topics.lock', {
tid: tid
}, Topics.lock);
} else {
socket.emit('api:topics.unlock', {
socket.emit('topics.unlock', {
tid: tid
}, Topics.unlock);
}
@ -39,11 +39,11 @@ define(function() {
case 'delete':
if (!$this.hasClass('active')) {
socket.emit('api:topics.delete', {
socket.emit('topics.delete', {
tid: tid
}, Topics.setDeleted);
} else {
socket.emit('api:topics.restore', {
socket.emit('topics.restore', {
tid: tid
}, Topics.restore);
}
@ -63,7 +63,7 @@ define(function() {
var lastTid = parseInt(topics[topics.length - 1].getAttribute('data-tid'));
this.innerHTML = '<i class="fa fa-refresh fa-spin"></i> Retrieving topics';
socket.emit('api:admin.topics.getMore', {
socket.emit('admin.topics.getMore', {
limit: 10,
after: lastTid
}, function(topics) {

@ -68,14 +68,14 @@ define(function() {
if (!isAdmin) {
if (isBanned) {
socket.emit('api:admin.user.unbanUser', uid);
socket.emit('admin.user.unbanUser', uid);
banBtn.removeClass('btn-warning');
parent.attr('data-banned', 0);
updateUserAdminButtons();
} else {
bootbox.confirm('Do you really want to ban "' + parent.attr('data-username') + '"?', function(confirm) {
if (confirm) {
socket.emit('api:admin.user.banUser', uid);
socket.emit('admin.user.banUser', uid);
banBtn.addClass('btn-warning');
parent.attr('data-banned', 1);
updateUserAdminButtons();
@ -103,7 +103,7 @@ define(function() {
});
}
else if (!isAdmin) {
socket.emit('api:admin.user.makeAdmin', uid);
socket.emit('admin.user.makeAdmin', uid);
adminBtn.attr('value', 'UnMake Admin').html('Remove Admin');
parent.attr('data-admin', 1);
updateUserBanButtons();
@ -111,7 +111,7 @@ define(function() {
} else if(uid !== yourid) {
bootbox.confirm('Do you really want to remove this user as admin "' + parent.attr('data-username') + '"?', function(confirm) {
if (confirm) {
socket.emit('api:admin.user.removeAdmin', uid);
socket.emit('admin.user.removeAdmin', uid);
adminBtn.attr('value', 'Make Admin').html('Make Admin');
parent.attr('data-admin', 0);
updateUserBanButtons();
@ -147,7 +147,7 @@ define(function() {
password: password
};
socket.emit('api:admin.user.createUser', user, function(err, data) {
socket.emit('admin.user.createUser', user, function(err, data) {
if(err) {
return errorEl.html('<strong>Error</strong><p>' + err + '</p>').removeClass('hide');
}
@ -188,7 +188,7 @@ define(function() {
jQuery('.fa-spinner').removeClass('none');
socket.emit('api:admin.user.search', username, function(err, data) {
socket.emit('admin.user.search', username, function(err, data) {
if(err) {
return app.alertError(err.message);
}
@ -242,7 +242,7 @@ define(function() {
if (set) {
loadingMoreUsers = true;
socket.emit('api:user.loadMore', {
socket.emit('user.loadMore', {
set: set,
after: $('#users-container').children().length
}, function(data) {

@ -40,7 +40,7 @@ define(['composer'], function(composer) {
socket.on('event:new_topic', Category.onNewTopic);
socket.emit('api:categories.getRecentReplies', cid, renderRecentReplies);
socket.emit('categories.getRecentReplies', cid, renderRecentReplies);
$(window).off('scroll').on('scroll', function (ev) {
var bottom = ($(document).height() - $(window).height()) * 0.9;
@ -81,7 +81,7 @@ define(['composer'], function(composer) {
}
topic.hide().fadeIn('slow');
socket.emit('api:categories.getRecentReplies', templates.get('category_id'), renderRecentReplies);
socket.emit('categories.getRecentReplies', templates.get('category_id'), renderRecentReplies);
addActiveUser(data);
@ -129,7 +129,7 @@ define(['composer'], function(composer) {
}
loadingMoreTopics = true;
socket.emit('api:categories.loadMore', {
socket.emit('categories.loadMore', {
cid: cid,
after: $('#topics-container').children('.category-item').length
}, function (data) {

@ -1,6 +1,6 @@
define(['notifications', 'chat'], function(Notifications, Chat) {
socket.emit('api:meta.updateHeader', {
socket.emit('meta.updateHeader', {
fields: ['username', 'picture', 'userslug']
}, app.updateHeader);
@ -14,5 +14,5 @@ define(['notifications', 'chat'], function(Notifications, Chat) {
}
socket.on('event:unread.updateCount', updateUnreadCount);
socket.emit('api:user.getUnreadCount', updateUnreadCount);
socket.emit('user.getUnreadCount', updateUnreadCount);
});

@ -4,21 +4,21 @@ define(function() {
home.init = function() {
ajaxify.register_events([
'api:user.count',
'post.stats',
'api:user.getActiveUsers'
'user.count',
'meta.getUsageStats',
'user.getActiveUsers'
]);
socket.emit('api:user.count', function(data) {
socket.emit('user.count', function(data) {
$('#stats_users').html(utils.makeNumberHumanReadable(data.count)).attr('title', data.count);
});
socket.emit('api:meta.getUsageStats', function(data) {
socket.emit('meta.getUsageStats', function(data) {
$('#stats_topics').html(utils.makeNumberHumanReadable(data.topics)).attr('title', data.topics);
$('#stats_posts').html(utils.makeNumberHumanReadable(data.posts)).attr('title', data.posts);
});
socket.emit('api:user.getActiveUsers', function(data) {
socket.emit('user.getActiveUsers', function(data) {
$('#stats_online').html(data.users);
});
}

@ -84,7 +84,7 @@ define(function() {
var html = templates.prepare(templates['recent'].blocks['topics']).parse({
topics: topics
});
translator.translate(html, function(translatedHTML) {
var container = $('#topics-container');
@ -99,7 +99,7 @@ define(function() {
Recent.loadMoreTopics = function() {
Recent.loadingMoreTopics = true;
socket.emit('api:topics.loadMoreRecentTopics', {
socket.emit('topics.loadMoreRecentTopics', {
after: $('#topics-container').children('li').length,
term: active
}, function(data) {

@ -42,7 +42,7 @@ define(function() {
if (!utils.isEmailValid(emailEl.val())) {
showError(email_notify, 'Invalid email address.');
} else {
socket.emit('api:user.emailExists', {
socket.emit('user.emailExists', {
email: emailEl.val()
}, function(exists) {
if (exists === true) {
@ -71,7 +71,7 @@ define(function() {
} else if (!utils.isUserNameValid(username.val()) || !utils.slugify(username.val())) {
showError(username_notify, 'Invalid username!');
} else {
socket.emit('api:user.exists', {
socket.emit('user.exists', {
username: username.val()
});
}
@ -123,9 +123,9 @@ define(function() {
validatePasswordConfirm();
});
ajaxify.register_events(['api:user.exists', 'api:user.emailExists']);
ajaxify.register_events(['user.exists', 'user.emailExists']);
socket.on('api:user.exists', function(data) {
socket.on('user.exists', function(data) {
if (data.exists === true) {
showError(username_notify, 'Username already taken!');
} else {

@ -8,7 +8,7 @@ define(function() {
document.getElementById('reset').onclick = function() {
if (inputEl.value.length > 0 && inputEl.value.indexOf('@') !== -1) {
socket.emit('api:user.reset.send', {
socket.emit('user.reset.send', {
email: inputEl.value
});
} else {

@ -21,7 +21,7 @@ define(function() {
noticeEl.querySelector('p').innerHTML = 'The two passwords you\'ve entered do not match.';
noticeEl.style.display = 'block';
} else {
socket.emit('api:user.reset.commit', {
socket.emit('user.reset.commit', {
code: reset_code,
password: password.value
});
@ -29,13 +29,13 @@ define(function() {
}, false);
// Enable the form if the code is valid
socket.emit('api:user.reset.valid', {
socket.emit('user.reset.valid', {
code: reset_code
});
ajaxify.register_events(['api:user.reset.valid', 'api:user.reset.commit']);
socket.on('api:user.reset.valid', function(data) {
ajaxify.register_events(['user.reset.valid', 'user.reset.commit']);
socket.on('user.reset.valid', function(data) {
if ( !! data.valid) resetEl.disabled = false;
else {
var formEl = document.getElementById('reset-form');
@ -45,7 +45,7 @@ define(function() {
}
})
socket.on('api:user.reset.commit', function(data) {
socket.on('user.reset.commit', function(data) {
if (data.status === 'ok') {
$('#error').hide();
$('#notice').hide();

@ -52,14 +52,14 @@ define(['composer'], function(composer) {
if (thread_state.deleted !== '1') {
bootbox.confirm('Are you sure you want to delete this thread?', function(confirm) {
if (confirm) {
socket.emit('api:topics.delete', {
socket.emit('topics.delete', {
tid: tid
}, null);
}
});
} else {
bootbox.confirm('Are you sure you want to restore this thread?', function(confirm) {
if (confirm) socket.emit('api:topics.restore', {
if (confirm) socket.emit('topics.restore', {
tid: tid
}, null);
});
@ -69,11 +69,11 @@ define(['composer'], function(composer) {
$('.lock_thread').on('click', function(e) {
if (thread_state.locked !== '1') {
socket.emit('api:topics.lock', {
socket.emit('topics.lock', {
tid: tid
}, null);
} else {
socket.emit('api:topics.unlock', {
socket.emit('topics.unlock', {
tid: tid
}, null);
}
@ -82,11 +82,11 @@ define(['composer'], function(composer) {
$('.pin_thread').on('click', function(e) {
if (thread_state.pinned !== '1') {
socket.emit('api:topics.pin', {
socket.emit('topics.pin', {
tid: tid
}, null);
} else {
socket.emit('api:topics.unpin', {
socket.emit('topics.unpin', {
tid: tid
}, null);
}
@ -102,7 +102,7 @@ define(['composer'], function(composer) {
var loadingEl = document.getElementById('categories-loading');
if (loadingEl) {
socket.emit('api:categories.get', function(data) {
socket.emit('categories.get', function(data) {
// Render categories
var categoriesFrag = document.createDocumentFragment(),
categoryEl = document.createElement('li'),
@ -145,7 +145,7 @@ define(['composer'], function(composer) {
$(moveThreadModal).find('.modal-header button').fadeOut(250);
commitEl.innerHTML = 'Moving <i class="fa-spin fa-refresh"></i>';
socket.emit('api:topics.move', {
socket.emit('topics.move', {
tid: tid,
cid: targetCid
}, function(data) {
@ -192,7 +192,7 @@ define(['composer'], function(composer) {
forkCommit.on('click', createTopicFromPosts);
function createTopicFromPosts() {
socket.emit('api:topics.createTopicFromPosts', {
socket.emit('topics.createTopicFromPosts', {
title: forkModal.find('#fork-title').val(),
pids: pids
}, function(err) {
@ -298,12 +298,12 @@ define(['composer'], function(composer) {
}
};
socket.emit('api:topics.followCheck', tid, function(state) {
socket.emit('topics.followCheck', tid, function(state) {
set_follow_state(state, true);
});
if (followEl[0]) {
followEl[0].addEventListener('click', function() {
socket.emit('api:topics.follow', tid, function(data) {
socket.emit('topics.follow', tid, function(data) {
if (data.status && data.status === 'ok') set_follow_state(data.follow);
else {
app.alert({
@ -375,7 +375,7 @@ define(['composer'], function(composer) {
username = '@' + post.attr('data-username');
}
socket.emit('api:posts.getRawPost', {pid: pid}, function(data) {
socket.emit('posts.getRawPost', {pid: pid}, function(data) {
quoted = '> ' + data.post.replace(/\n/g, '\n> ') + '\n\n';
@ -389,12 +389,12 @@ define(['composer'], function(composer) {
var uid = $(this).parents('li').attr('data-uid');
if ($(this).attr('data-favourited') == 'false') {
socket.emit('api:posts.favourite', {
socket.emit('posts.favourite', {
pid: pid,
room_id: app.currentRoom
});
} else {
socket.emit('api:posts.unfavourite', {
socket.emit('posts.unfavourite', {
pid: pid,
room_id: app.currentRoom
});
@ -441,7 +441,7 @@ define(['composer'], function(composer) {
if (confirmDel) {
if(deleteAction) {
socket.emit('api:posts.delete', {
socket.emit('posts.delete', {
pid: pid,
tid: tid
}, function(err) {
@ -450,7 +450,7 @@ define(['composer'], function(composer) {
}
});
} else {
socket.emit('api:posts.restore', {
socket.emit('posts.restore', {
pid: pid,
tid: tid
}, function(err) {
@ -488,7 +488,7 @@ define(['composer'], function(composer) {
});
moveBtn.on('click', function() {
socket.emit('api:topics.movePost', {pid: pid, tid: topicId.val()}, function(err) {
socket.emit('topics.movePost', {pid: pid, tid: topicId.val()}, function(err) {
if(err) {
return app.alertError(err.message);
}
@ -515,15 +515,15 @@ define(['composer'], function(composer) {
});
ajaxify.register_events([
'event:rep_up', 'event:rep_down', 'event:new_post', 'api:get_users_in_room',
'event:rep_up', 'event:rep_down', 'event:new_post', 'get_users_in_room',
'event:topic_deleted', 'event:topic_restored', 'event:topic:locked',
'event:topic_unlocked', 'event:topic_pinned', 'event:topic_unpinned',
'event:topic_moved', 'event:post_edited', 'event:post_deleted', 'event:post_restored',
'api:posts.favourite'
'posts.favourite'
]);
socket.on('api:get_users_in_room', function(data) {
socket.on('get_users_in_room', function(data) {
if(data) {
var activeEl = $('.thread_active_users');
@ -689,7 +689,7 @@ define(['composer'], function(composer) {
});
socket.on('api:posts.favourite', function(data) {
socket.on('posts.favourite', function(data) {
if (data.status === 'ok' && data.pid) {
var favBtn = $('li[data-pid="' + data.pid + '"] .favourite');
if(favBtn.length) {
@ -700,7 +700,7 @@ define(['composer'], function(composer) {
}
});
socket.on('api:posts.unfavourite', function(data) {
socket.on('posts.unfavourite', function(data) {
if (data.status === 'ok' && data.pid) {
var favBtn = $('li[data-pid="' + data.pid + '"] .favourite');
if(favBtn.length) {
@ -861,7 +861,7 @@ define(['composer'], function(composer) {
favEl = postEl.find('.favourite'),
replyEl = postEl.find('.post_reply');
socket.emit('api:posts.getPrivileges', pid, function(privileges) {
socket.emit('posts.getPrivileges', pid, function(privileges) {
if (privileges.editable) {
if (!postEl.hasClass('deleted')) {
toggle_post_tools(pid, false);
@ -1056,7 +1056,7 @@ define(['composer'], function(composer) {
.fadeIn('slow');
for (var x = 0, numPosts = data.posts.length; x < numPosts; x++) {
socket.emit('api:posts.getPrivileges', data.posts[x].pid, function(privileges) {
socket.emit('posts.getPrivileges', data.posts[x].pid, function(privileges) {
toggle_mod_tools(privileges.pid, privileges.editable);
});
}
@ -1087,7 +1087,7 @@ define(['composer'], function(composer) {
}
function updatePostCount() {
socket.emit('api:topics.postcount', templates.get('topic_id'), function(err, postcount) {
socket.emit('topics.postcount', templates.get('topic_id'), function(err, postcount) {
if(!err) {
Topic.postCount = postcount;
$('#topic-post-count').html(Topic.postCount);
@ -1109,7 +1109,7 @@ define(['composer'], function(composer) {
indicatorEl.fadeIn();
}
socket.emit('api:topics.loadMore', {
socket.emit('topics.loadMore', {
tid: tid,
after: parseInt($('#post-container .post-row.infiniteloaded').last().attr('data-index'), 10) + 1
}, function (data) {

@ -8,7 +8,7 @@ define(function() {
ajaxify.register_events([
'event:new_topic',
'event:new_post',
'api:topics.markAllRead'
'topics.markAllRead'
]);
var newTopicCount = 0,
@ -55,7 +55,7 @@ define(function() {
$('#mark-allread-btn').on('click', function() {
var btn = $(this);
socket.emit('api:topics.markAllRead', {}, function(success) {
socket.emit('topics.markAllRead', {}, function(success) {
if (success) {
btn.remove();
$('#topics-container').empty();
@ -91,7 +91,7 @@ define(function() {
function loadMoreTopics() {
loadingMoreTopics = true;
socket.emit('api:topics.loadMoreUnreadTopics', {
socket.emit('topics.loadMoreUnreadTopics', {
after: parseInt($('#topics-container').attr('data-next-start'), 10)
}, function(data) {
if (data.topics && data.topics.length) {

@ -47,7 +47,7 @@ define(function() {
jQuery('#user-notfound-notify').html('<i class="fa fa-spinner fa-spin"></i>');
setTimeout(function() {
socket.emit('api:admin.user.search', username, function(err, data) {
socket.emit('admin.user.search', username, function(err, data) {
if(err) {
return app.alert(err.message);
}
@ -80,10 +80,10 @@ define(function() {
}, 250);
});
socket.on('api:user.isOnline', function(data) {
socket.on('user.isOnline', function(data) {
if(getActiveSection() == 'online' && !loadingMoreUsers) {
startLoading('users:online', 0, true);
socket.emit('api:user.getOnlineAnonCount', {} , function(anonCount) {
socket.emit('user.getOnlineAnonCount', {} , function(anonCount) {
if(parseInt(anonCount, 10) > 0) {
$('#users-container .anon-user').removeClass('hide');
$('#online_anon_count').html(anonCount);
@ -123,7 +123,7 @@ define(function() {
function startLoading(set, after, emptyContainer) {
loadingMoreUsers = true;
socket.emit('api:user.loadMore', {
socket.emit('user.loadMore', {
set: set,
after: after
}, function(data) {

@ -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('');
}
}

@ -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(),

@ -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 {

Loading…
Cancel
Save