Skip to content

Node.js based forum software built for the modern web

closes #2982

barisusakli45bf5de1e5ea
diff --git a/public/src/client/topic/events.js b/public/src/client/topic/events.js
index 0090e37af9..1013f49ff0 100644
--- a/public/src/client/topic/events.js
+++ b/public/src/client/topic/events.js
@@ -1,7 +1,7 @@
'use strict';
-/* globals app, ajaxify, define, socket, templates */
+/* globals config, app, ajaxify, define, socket, templates */
define('forum/topic/events', [
'forum/topic/browsing',
@@ -101,6 +101,9 @@ define('forum/topic/events', [
topicTitle = components.get('topic/title');
if (topicTitle.length && data.title) {
+ var newUrl = 'topic/' + data.slug + (window.location.search ? window.location.search : '');
+ history.replaceState({url: newUrl}, null, window.location.protocol + '//' + window.location.host + config.relative_path + '/' + newUrl);
+
topicTitle.fadeOut(250, function() {
topicTitle.html(data.title).fadeIn(250);
});
diff --git a/src/postTools.js b/src/postTools.js
index 41f0a4b6ed..82f3e3604d 100644
--- a/src/postTools.js
+++ b/src/postTools.js
@@ -115,6 +115,7 @@ var cache = LRU({
cid: results.cid,
uid: postData.uid,
title: validator.escape(title),
+ slug: topicData.slug,
isMainPost: results.isMain,
tags: tags
});
diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js
index d8a3104397..1dfe59bfb7 100644
--- a/src/socket.io/posts.js
+++ b/src/socket.io/posts.js
@@ -310,6 +310,7 @@ SocketPosts.edit = function(socket, data, callback) {
pid: data.pid,
handle: data.handle,
title: results.topic.title,
+ slug: results.topic.slug,
isMainPost: results.topic.isMainPost,
tags: results.topic.tags,
content: results.content