mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-19 22:12:54 +01:00
new post event (although there is a bug... hmhm)
This commit is contained in:
@@ -91,10 +91,27 @@
|
||||
]);
|
||||
|
||||
socket.on('event:new_topic', function(data) {
|
||||
console.log(data);
|
||||
var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] });
|
||||
var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] }),
|
||||
topic = document.createElement('div'),
|
||||
container = document.getElementById('topics-container'),
|
||||
topics = document.querySelectorAll('#topics-container a'),
|
||||
numTopics = topics.length,
|
||||
x;
|
||||
|
||||
jQuery('<div></div>').appendTo("#topics-container").hide().append(html).fadeIn('slow');
|
||||
topic.innerHTML = html;
|
||||
if (numTopics > 0) {
|
||||
for(x=0;x<numTopics;x++) {
|
||||
if (topics[x].querySelector('.icon-pushpin')) continue;
|
||||
container.insertBefore(topic, topics[x]);
|
||||
$(topic).hide().fadeIn('slow');
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
container.insertBefore(topic, null);
|
||||
$(topic).hide().fadeIn('slow');
|
||||
}
|
||||
|
||||
// jQuery('<div></div>').appendTo("#topics-container").hide().append(html).fadeIn('slow');
|
||||
// set_up_posts(uniqueid);
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -374,7 +374,7 @@ marked.setOptions({
|
||||
Topics.unlock = function(tid, uid, socket) {
|
||||
user.getUserField(uid, 'reputation', function(rep) {
|
||||
if (rep >= configs.privilege_thresholds.manage_thread) {
|
||||
// Mark thread as locked
|
||||
// Mark thread as unlocked
|
||||
RDB.del('tid:' + tid + ':locked');
|
||||
|
||||
if (socket) {
|
||||
@@ -407,7 +407,7 @@ marked.setOptions({
|
||||
Topics.restore = function(tid, uid, socket) {
|
||||
user.getUserField(uid, 'reputation', function(rep) {
|
||||
if (rep >= configs.privilege_thresholds.manage_thread) {
|
||||
// Mark thread as deleted
|
||||
// Mark thread as restored
|
||||
RDB.del('tid:' + tid + ':deleted');
|
||||
Topics.unlock(tid, uid);
|
||||
|
||||
@@ -424,7 +424,7 @@ marked.setOptions({
|
||||
Topics.pin = function(tid, uid, socket) {
|
||||
user.getUserField(uid, 'reputation', function(rep) {
|
||||
if (rep >= configs.privilege_thresholds.manage_thread) {
|
||||
// Mark thread as deleted
|
||||
// Mark thread as pinned
|
||||
RDB.set('tid:' + tid + ':pinned', 1);
|
||||
|
||||
if (socket) {
|
||||
@@ -440,7 +440,7 @@ marked.setOptions({
|
||||
Topics.unpin = function(tid, uid, socket) {
|
||||
user.getUserField(uid, 'reputation', function(rep) {
|
||||
if (rep >= configs.privilege_thresholds.manage_thread) {
|
||||
// Mark thread as deleted
|
||||
// Mark thread as unpinned
|
||||
RDB.del('tid:' + tid + ':pinned');
|
||||
|
||||
if (socket) {
|
||||
|
||||
Reference in New Issue
Block a user