anons cant edit after posting #365

This commit is contained in:
Baris Usakli
2013-11-01 13:45:24 -04:00
parent 0179a55ee4
commit c8ec095d99
5 changed files with 21 additions and 7 deletions

View File

@@ -541,8 +541,15 @@ module.exports.init = function(io) {
});
socket.on('api:posts.edit', function(data) {
if (!data.title || data.title.length < topics.minimumTitleLength) {
if(!uid) {
socket.emit('event:alert', {
title: 'Can&apos;t edit',
message: 'Guests can&apos;t edit posts!',
type: 'warning',
timeout: 2000
});
return;
} else if (!data.title || data.title.length < topics.minimumTitleLength) {
topics.emitTitleTooShortAlert(socket);
return;
} else if (!data.content || data.content.length < require('../public/config.json').minimumPostLength) {