fixed topic reply if title was 255, better notif text in unread and recent,removed console.log

v1.18.x
Baris Soner Usakli 11 years ago
parent 79803d2b3d
commit 46fb6377ee

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

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

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

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

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

Loading…
Cancel
Save