This commit is contained in:
syuilo
2017-10-07 03:36:46 +09:00
parent f89c3af982
commit 6a5c6280ff
19 changed files with 150 additions and 11 deletions

View File

@@ -1,35 +0,0 @@
const summarize = post => {
let summary = post.text ? post.text : '';
// メディアが添付されているとき
if (post.media) {
summary += ` (${post.media.length}つのメディア)`;
}
// 投票が添付されているとき
if (post.poll) {
summary += ' (投票)';
}
// 返信のとき
if (post.reply_to_id) {
if (post.reply_to) {
summary += ` RE: ${summarize(post.reply_to)}`;
} else {
summary += ' RE: ...';
}
}
// Repostのとき
if (post.repost_id) {
if (post.repost) {
summary += ` RP: ${summarize(post.repost)}`;
} else {
summary += ' RP: ...';
}
}
return summary.trim();
};
export default summarize;

View File

@@ -11,7 +11,7 @@ import * as riot from 'riot';
import init from '../init';
import route from './router';
import fuckAdBlock from './scripts/fuck-ad-block';
import getPostSummary from '../common/scripts/get-post-summary';
import getPostSummary from '../../../common/get-post-summary';
/**
* init

View File

@@ -207,7 +207,7 @@
</style>
<script>
import getPostSummary from '../../common/scripts/get-post-summary';
import getPostSummary from '../../../../common/get-post-summary';
this.getPostSummary = getPostSummary;
this.mixin('i');

View File

@@ -8,7 +8,7 @@
</style>
<script>
import Progress from '../../../common/scripts/loading';
import getPostSummary from '../../../common/scripts/get-post-summary';
import getPostSummary from '../../../../../common/get-post-summary';
this.mixin('i');
this.mixin('api');

View File

@@ -110,7 +110,7 @@
</style>
<script>
import getPostSummary from '../../common/scripts/get-post-summary';
import getPostSummary from '../../../../common/get-post-summary';
this.getPostSummary = getPostSummary;
this.notification = this.opts.notification;
</script>

View File

@@ -163,7 +163,7 @@
</style>
<script>
import getPostSummary from '../../common/scripts/get-post-summary';
import getPostSummary from '../../../../common/get-post-summary';
this.getPostSummary = getPostSummary;
this.notification = this.opts.notification;
</script>

View File

@@ -78,7 +78,7 @@
</style>
<script>
import getPostSummary from '../../common/scripts/get-post-summary';
import getPostSummary from '../../../../common/get-post-summary';
this.getPostSummary = getPostSummary;
this.mixin('api');

View File

@@ -9,7 +9,7 @@
<script>
import ui from '../../scripts/ui-event';
import Progress from '../../../common/scripts/loading';
import getPostSummary from '../../../common/scripts/get-post-summary';
import getPostSummary from '../../../../../common/get-post-summary';
import openPostForm from '../../scripts/open-post-form';
this.mixin('i');

View File

@@ -264,7 +264,7 @@
</style>
<script>
import compile from '../../common/scripts/text-compiler';
import getPostSummary from '../../common/scripts/get-post-summary';
import getPostSummary from '../../../../common/get-post-summary';
import openPostForm from '../scripts/open-post-form';
this.mixin('api');

View File

@@ -464,7 +464,7 @@
</style>
<script>
import compile from '../../common/scripts/text-compiler';
import getPostSummary from '../../common/scripts/get-post-summary';
import getPostSummary from '../../../../common/get-post-summary';
import openPostForm from '../scripts/open-post-form';
this.mixin('api');

View File

@@ -428,7 +428,7 @@
</style>
<script>
import summary from '../../common/scripts/get-post-summary';
import summary from '../../../../common/get-post-summary';
this.post = this.opts.post;
this.text = summary(this.post);