update url with new slug on topic title edit
v1.18.x
barisusakli 10 years ago
parent 5c59aa7737
commit 45bf5de1e5

@ -1,7 +1,7 @@
'use strict'; 'use strict';
/* globals app, ajaxify, define, socket, templates */ /* globals config, app, ajaxify, define, socket, templates */
define('forum/topic/events', [ define('forum/topic/events', [
'forum/topic/browsing', 'forum/topic/browsing',
@ -101,6 +101,9 @@ define('forum/topic/events', [
topicTitle = components.get('topic/title'); topicTitle = components.get('topic/title');
if (topicTitle.length && data.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.fadeOut(250, function() {
topicTitle.html(data.title).fadeIn(250); topicTitle.html(data.title).fadeIn(250);
}); });

@ -115,6 +115,7 @@ var cache = LRU({
cid: results.cid, cid: results.cid,
uid: postData.uid, uid: postData.uid,
title: validator.escape(title), title: validator.escape(title),
slug: topicData.slug,
isMainPost: results.isMain, isMainPost: results.isMain,
tags: tags tags: tags
}); });

@ -310,6 +310,7 @@ SocketPosts.edit = function(socket, data, callback) {
pid: data.pid, pid: data.pid,
handle: data.handle, handle: data.handle,
title: results.topic.title, title: results.topic.title,
slug: results.topic.slug,
isMainPost: results.topic.isMainPost, isMainPost: results.topic.isMainPost,
tags: results.topic.tags, tags: results.topic.tags,
content: results.content content: results.content

Loading…
Cancel
Save