From cf33e483f7e6f40e8cbbbc0118a7df70bdaf651f Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 29 Mar 2018 20:32:18 +0900 Subject: 整理した MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/common/get-post-summary.ts | 45 ----------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 src/server/common/get-post-summary.ts (limited to 'src/server/common/get-post-summary.ts') diff --git a/src/server/common/get-post-summary.ts b/src/server/common/get-post-summary.ts deleted file mode 100644 index 8d0033064f..0000000000 --- a/src/server/common/get-post-summary.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * 投稿を表す文字列を取得します。 - * @param {*} post 投稿 - */ -const summarize = (post: any): string => { - let summary = ''; - - // チャンネル - summary += post.channel ? `${post.channel.title}:` : ''; - - // 本文 - summary += post.text ? post.text : ''; - - // メディアが添付されているとき - if (post.media) { - summary += ` (${post.media.length}つのメディア)`; - } - - // 投票が添付されているとき - if (post.poll) { - summary += ' (投票)'; - } - - // 返信のとき - if (post.replyId) { - if (post.reply) { - summary += ` RE: ${summarize(post.reply)}`; - } else { - summary += ' RE: ...'; - } - } - - // Repostのとき - if (post.repostId) { - if (post.repost) { - summary += ` RP: ${summarize(post.repost)}`; - } else { - summary += ' RP: ...'; - } - } - - return summary.trim(); -}; - -export default summarize; -- cgit v1.2.3-freya