summaryrefslogtreecommitdiff
path: root/src/web/app/common/scripts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-02-18 13:07:34 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-02-18 13:07:34 +0900
commit6836662bffc501911902b4168e08716a90595ae8 (patch)
treecfb479f9b74bf9d6f5fad64e928e94149f545c8d /src/web/app/common/scripts
parent:v: (diff)
downloadmisskey-6836662bffc501911902b4168e08716a90595ae8.tar.gz
misskey-6836662bffc501911902b4168e08716a90595ae8.tar.bz2
misskey-6836662bffc501911902b4168e08716a90595ae8.zip
:v:
Diffstat (limited to 'src/web/app/common/scripts')
-rw-r--r--src/web/app/common/scripts/get-post-summary.js37
-rw-r--r--src/web/app/common/scripts/get-post-summary.ls30
2 files changed, 37 insertions, 30 deletions
diff --git a/src/web/app/common/scripts/get-post-summary.js b/src/web/app/common/scripts/get-post-summary.js
new file mode 100644
index 0000000000..8e17d54e81
--- /dev/null
+++ b/src/web/app/common/scripts/get-post-summary.js
@@ -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;
diff --git a/src/web/app/common/scripts/get-post-summary.ls b/src/web/app/common/scripts/get-post-summary.ls
deleted file mode 100644
index 67178bc324..0000000000
--- a/src/web/app/common/scripts/get-post-summary.ls
+++ /dev/null
@@ -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