Node.js based forum software built for the modern web
fixed topic reply if title was 255, better notif text in unread and recent,removed console.log
Baris Soner Usakli46fb6377ee8c
diff --git a/public/src/forum/recent.js b/public/src/forum/recent.jsindex 4694152125..24ad184a6b 100644--- a/public/src/forum/recent.js+++ b/public/src/forum/recent.js@@ -59,23 +59,21 @@ define(function() {};Recent.updateAlertText = function() {- var text = '';-- if (Recent.newTopicCount > 1)- text = 'There are ' + Recent.newTopicCount + ' new topics';- else if (Recent.newTopicCount === 1)- text = 'There is 1 new topic';- else- text = 'There are no new topics';-- if (Recent.newPostCount > 1)- text += ' and ' + Recent.newPostCount + ' new posts.';- else if (Recent.newPostCount === 1)- text += ' and 1 new post.';- else- text += ' and no new posts.';-- text += ' Click here to reload.';+ var text = 'There';++ if (newTopicCount > 1) {+ text += ' are ' + newTopicCount + ' new topics';+ } else if (newTopicCount === 1) {+ text += ' is a new topic';+ }++ if (newPostCount > 1) {+ text += (newTopicCount?' and ':' are ') + newPostCount + ' new posts';+ } else if(newPostCount === 1) {+ text += (newTopicCount?' and ':' is ') + ' a new post';+ }++ text += '. Click here to reload.';$('#new-topics-alert').html(text).removeClass('hide').fadeIn('slow');}diff --git a/public/src/forum/topic.js b/public/src/forum/topic.jsindex be1022c12c..5b4e10408c 100644--- a/public/src/forum/topic.js+++ b/public/src/forum/topic.js@@ -367,7 +367,6 @@ define(['composer'], function(composer) {}$('.topic').on('click', '.post_reply', function() {- console.log('gg twice');var selectionText = '',selection = window.getSelection() || document.getSelection();diff --git a/public/src/forum/unread.js b/public/src/forum/unread.jsindex aa70690165..7f9cd68b95 100644--- a/public/src/forum/unread.js+++ b/public/src/forum/unread.js@@ -19,16 +19,25 @@ define(function() {});socket.on('event:new_topic', function(data) {-++newTopicCount;updateAlertText();-});function updateAlertText() {- var text = '';+ var text = 'There';- if (newTopicCount > 1)+ if (newTopicCount > 1) {+ text += ' are ' + newTopicCount + ' new topics';+ } else if (newTopicCount === 1) {+ text += ' is a new topic';+ }++ if (newPostCount > 1) {+ text += (newTopicCount?' and ':' are ') + newPostCount + ' new posts';+ } else if(newPostCount === 1) {+ text += (newTopicCount?' and ':' is ') + ' a new post';+ }+ /*if (newTopicCount > 1)text = 'There are ' + newTopicCount + ' new topics';else if (newTopicCount === 1)text = 'There is 1 new topic';@@ -40,9 +49,9 @@ define(function() {else if (newPostCount === 1)text += ' and 1 new post.';else- text += ' and no new posts.';+ text += ' and no new posts.';*/- text += ' Click here to reload.';+ text += '. Click here to reload.';$('#new-topics-alert').html(text).removeClass('hide').fadeIn('slow');$('#category-no-topics').addClass('hidden');diff --git a/public/src/modules/composer.js b/public/src/modules/composer.jsindex 966afa6ae0..8b900fd8f0 100644--- a/public/src/modules/composer.js+++ b/public/src/modules/composer.js@@ -384,18 +384,19 @@ define(['taskbar'], function(taskbar) {titleEl.val(titleEl.val().trim());bodyEl.val(bodyEl.val().trim());+ var checkTitle = parseInt(postData.cid, 10) || parseInt(postData.pid, 10);+if(postData.uploadsInProgress && postData.uploadsInProgress.length) {return composerAlert('Still uploading', 'Please wait for uploads to complete.');- } else if (titleEl.val().length < parseInt(config.minimumTitleLength, 10)) {+ } else if (checkTitle && titleEl.val().length < parseInt(config.minimumTitleLength, 10)) {return composerAlert('Title too short', 'Please enter a longer title. At least ' + config.minimumTitleLength+ ' characters.');- } else if (titleEl.val().length > parseInt(config.maximumTitleLength, 10)) {+ } else if (checkTitle && titleEl.val().length > parseInt(config.maximumTitleLength, 10)) {return composerAlert('Title too long', 'Please enter a shorter title. Titles can\'t be longer than ' + config.maximumTitleLength + ' characters.');} else if (bodyEl.val().length < parseInt(config.minimumPostLength, 10)) {return composerAlert('Content too short', 'Please enter a longer post. At least ' + config.minimumPostLength + ' characters.');}- // Still here? Let's post.- if (parseInt(postData.cid) > 0) {+ if (parseInt(postData.cid, 10) > 0) {socket.emit('topics.post', {'title' : titleEl.val(),'content' : bodyEl.val(),@@ -403,14 +404,14 @@ define(['taskbar'], function(taskbar) {}, function() {composer.discard(post_uuid);});- } else if (parseInt(postData.tid) > 0) {+ } else if (parseInt(postData.tid, 10) > 0) {socket.emit('posts.reply', {'topic_id' : postData.tid,'content' : bodyEl.val()}, function() {composer.discard(post_uuid);});- } else if (parseInt(postData.pid) > 0) {+ } else if (parseInt(postData.pid, 10) > 0) {socket.emit('posts.edit', {pid: postData.pid,content: bodyEl.val(),diff --git a/public/templates/header.tpl b/public/templates/header.tplindex 6ee3cbb513..14c53b3b9d 100644--- a/public/templates/header.tpl+++ b/public/templates/header.tpl@@ -104,7 +104,7 @@</li><li class="chats dropdown text-center hidden-xs">- <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="chat_dropdown"><i class="fa fa-comment"></i></a>+ <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="chat_dropdown"><i class="fa fa-comment-o"></i></a><ul id="chat-list" class="dropdown-menu" aria-labelledby="chat_dropdown"><li><a href="#"><i class="fa fa-refresh fa-spin"></i> [[global:chats.loading]]</a>