mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-25 07:16:43 -06:00
✌️
This commit is contained in:
parent
6f6723e1c2
commit
6836662bff
3 changed files with 38 additions and 31 deletions
|
@ -21,7 +21,7 @@ module.exports = (me) ~>
|
|||
is-promise: require './scripts/is-promise.ls'
|
||||
|
||||
riot.mixin \get-post-summary do
|
||||
get-post-summary: require './scripts/get-post-summary.ls'
|
||||
get-post-summary: require './scripts/get-post-summary.js'
|
||||
|
||||
riot.mixin \date-stringify do
|
||||
date-stringify: require './scripts/date-stringify.ls'
|
||||
|
|
37
src/web/app/common/scripts/get-post-summary.js
Normal file
37
src/web/app/common/scripts/get-post-summary.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
const getPostSummary = post => {
|
||||
let = post.text ? post.text : '';
|
||||
|
||||
// メディアが添付されているとき
|
||||
if (post.media) {
|
||||
summary += ` (${post.media.length}つのメディア)`;
|
||||
}
|
||||
|
||||
// 投票が添付されているとき
|
||||
if (post.poll) {
|
||||
summary += ' (投票)';
|
||||
}
|
||||
|
||||
// 返信のとき
|
||||
if (post.reply_to_id) {
|
||||
if (post.reply_to) {
|
||||
replySummary = getPostSummary(post.reply_to);
|
||||
summary += ` RE: ${replySummary}`;
|
||||
} else {
|
||||
summary += ' RE: ...';
|
||||
}
|
||||
}
|
||||
|
||||
// Repostのとき
|
||||
if (post.repost_id) {
|
||||
if (post.repost) {
|
||||
repostSummary = getPostSummary(post.repost);
|
||||
summary += ` RP: ${repostSummary}`;
|
||||
} else {
|
||||
summary += ' RP: ...';
|
||||
}
|
||||
}
|
||||
|
||||
return summary.trim();
|
||||
};
|
||||
|
||||
module.exports = getPostSummary;
|
|
@ -1,30 +0,0 @@
|
|||
get-post-summary = (post) ~>
|
||||
summary = if post.text? then post.text else ''
|
||||
|
||||
# メディアが添付されているとき
|
||||
if post.media?
|
||||
summary += " (#{post.media.length}つのメディア)"
|
||||
|
||||
# 投票が添付されているとき
|
||||
if post.poll?
|
||||
summary += " (投票)"
|
||||
|
||||
# 返信のとき
|
||||
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
|
Loading…
Reference in a new issue