增加解析即刻用户动态中的创建主题类消息 (#227)

Signed-off-by: 朵爷 <soyaine@outlook.com>
This commit is contained in:
无糖玛文朵
2018-05-28 22:49:19 +08:00
committed by DIYgod
parent fe90de2202
commit 0fc6b4da61
+5
View File
@@ -32,6 +32,7 @@ module.exports = async (ctx) => {
REPOST: '转发',
ANSWER: '回答',
QUESTION: '提问',
PERSONAL_UPDATE: '创建新主题',
};
const linkMap = {
@@ -40,6 +41,7 @@ module.exports = async (ctx) => {
REPOST: `https://web.okjike.com/post-detail/${item.id}/repost`,
ANSWER: `https://m.okjike.com/answers/${item.id}`,
QUESTION: `https://m.okjike.com/questions/${item.id}`,
PERSONAL_UPDATE: `https://web.okjike.com/topic/${item.topic && item.topic.id}/official`,
};
let linkTemplate = '';
@@ -97,6 +99,9 @@ module.exports = async (ctx) => {
content = `${content}${answerContent}`.replace(/\n|\r/g, '<br>');
} else if (item.type === 'QUESTION') {
content = `在主题 <a href="https://web.okjike.com/topic/${item.topic.id}/official" target="_blank">${item.topic.content}</a> 提出了一个问题:<br><br>${content}`;
} else if (item.type === 'PERSONAL_UPDATE') {
shortenTitle = item.topic.content;
content = `<img referrerpolicy="no-referrer" src="${item.topic.squarePicture.picUrl}"> 主题简介:<br>${item.topic.briefIntro.replace(/(?:\r\n|\r|\n)/g, '<br>')}`;
}
return {