2016-12-28 23:49:51 +01:00
|
|
|
get-post-summary = (post) ~>
|
|
|
|
summary = if post.text? then post.text else ''
|
|
|
|
|
|
|
|
# メディアが添付されているとき
|
|
|
|
if post.media?
|
2017-02-15 00:16:40 +01:00
|
|
|
summary += " (#{post.media.length}つのメディア)"
|
2017-02-14 16:17:03 +01:00
|
|
|
|
|
|
|
# 投票が添付されているとき
|
|
|
|
if post.poll?
|
|
|
|
summary += " (投票)"
|
2016-12-28 23:49:51 +01:00
|
|
|
|
|
|
|
# 返信のとき
|
|
|
|
if post.reply_to_id?
|
|
|
|
if post.reply_to?
|
|
|
|
reply-summary = get-post-summary post.reply_to
|
|
|
|
summary += " RE: #{reply-summary}"
|
|
|
|
else
|
|
|
|
summary += " RE: ..."
|
|
|
|
|
|
|
|
# Repostのとき
|
|
|
|
if post.repost_id?
|
|
|
|
if post.repost?
|
|
|
|
repost-summary = get-post-summary post.repost
|
|
|
|
summary += " RP: #{repost-summary}"
|
|
|
|
else
|
|
|
|
summary += " RP: ..."
|
|
|
|
|
|
|
|
return summary.trim!
|
|
|
|
|
|
|
|
module.exports = get-post-summary
|