Skip to content

Commit 18a7d32

Browse files
Only set topic fields if they already exist
Restoring a previous version of a topic with the Edit History function was setting the title and slug to null. This fix only sets the fields if they already exist to avoid deleting the values.
1 parent 41e84fd commit 18a7d32

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,18 @@ var Beep = {
141141
parseTopic: function (data, callback) {
142142
// from http://htmlarrows.com/symbols/
143143
var starHTML = '*';
144-
data.topic.title = Beep.parseContent(data.topic.title, starHTML);
145-
data.topic.slug = Beep.parseContent(data.topic.slug, starHTML);
146-
data.topic.titleRaw = Beep.parseContent(data.topic.titleRaw, starHTML);
144+
145+
if (data.topic.hasOwnProperty('title')) {
146+
data.topic.title = Beep.parseContent(data.topic.title, starHTML);
147+
}
148+
149+
if (data.topic.hasOwnProperty('slug')) {
150+
data.topic.slug = Beep.parseContent(data.topic.slug, starHTML);
151+
}
152+
153+
if (data.topic.hasOwnProperty('titleRaw')) {
154+
data.topic.titleRaw = Beep.parseContent(data.topic.titleRaw, starHTML);
155+
}
147156

148157
callback(null, data);
149158
},

0 commit comments

Comments
 (0)