Node.js based forum software built for the modern web
editing of posts using new post window
Julian Lam82736d878073
diff --git a/public/src/modules/composer.js b/public/src/modules/composer.jsindex 69cfba3350..f482542b2f 100644--- a/public/src/modules/composer.js+++ b/public/src/modules/composer.js@@ -43,14 +43,14 @@ define(function() {socket.on('api:composer.push', function(threadData) {var uuid = utils.generateUUID(),btnEl = document.createElement('li');- btnEl.innerHTML = '<a href="#"><img src="/graph/users/' + threadData.username + '/picture" /><span>' + threadData.title + '</span></a>';+ btnEl.innerHTML = '<a href="#"><img src="/graph/users/' + threadData.username + '/picture" /><span>' + (!threadData.cid ? (threadData.title || '') : 'New Topic') + '</span></a>';btnEl.setAttribute('data-uuid', uuid);composer.listEl.appendChild(btnEl);composer.posts[uuid] = {tid: threadData.tid,cid: threadData.cid,pid: threadData.pid,- title: threadData.tid ? threadData.title : '',+ title: threadData.title || '',body: threadData.body || ''};composer.active++;@@ -170,6 +170,7 @@ define(function() {titleEl.value = 'Replying to: ' + post_data.title;titleEl.readonly = true;} else if (post_data.pid > 0) {+ console.log(post_data);titleEl.value = 'Editing: ' + post_data.title;titleEl.readonly = true;} else {@@ -180,6 +181,8 @@ define(function() {// Highlight the button$('.posts-bar li').removeClass('active');composer.btnContainer.querySelector('[data-uuid="' + post_uuid + '"]').className += ' active';++ //}composer.post = function(post_uuid) {@@ -198,7 +201,7 @@ define(function() {}// Still here? Let's post.- if (postData.tid === 0 || postData.cid) {+ if (parseInt(postData.cid) > 0) {socket.emit('api:topics.post', {'title' : titleEl.value,'content' : bodyEl.value,@@ -209,6 +212,12 @@ define(function() {'topic_id' : postData.tid,'content' : bodyEl.value});+ } else if (parseInt(postData.pid) > 0) {+ socket.emit('api:posts.edit', {+ pid: postData.pid,+ content: bodyEl.value,+ title: titleEl.value+ });}composer.discard(post_uuid);diff --git a/src/websockets.js b/src/websockets.jsindex 3700a1cc59..3f254b7a27 100644--- a/src/websockets.js+++ b/src/websockets.js@@ -319,7 +319,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),tid: 0,cid: data.cid,username: username,- title: 'New Topic'+ title: undefined});});} else if (parseInt(data.pid) > 0) {