Skip to content

Commit

Permalink
Welcome TLをハイライトに
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Nov 23, 2019
1 parent e4b8966 commit 48d04bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
26 changes: 5 additions & 21 deletions src/client/app/common/views/components/welcome-timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,11 @@ export default Vue.extend({
return {
fetching: true,
notes: [],
connection: null
};
},
mounted() {
this.fetch();
this.connection = this.$root.stream.useSharedConnection('localTimeline');
this.connection.on('note', this.onNote);
},
beforeDestroy() {
Expand All @@ -59,27 +54,16 @@ export default Vue.extend({
methods: {
fetch(cb?) {
this.fetching = true;
this.$root.api('notes', {
this.$root.api('notes/featured', {
limit: this.max,
local: true,
reply: false,
renote: false,
file: false,
poll: false
}).then(notes => {
days: 0.5,
}).then((notes: any[]) => {
notes.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
this.notes = notes;
this.fetching = false;
});
},
onNote(note) {
if (note.replyId != null) return;
if (note.renoteId != null) return;
if (note.poll != null) return;
if (note.localOnly) return;
this.notes.unshift(note);
},
}
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/desktop/views/pages/welcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

<div class="side">
<div class="tl block">
<header><fa :icon="['far', 'comment-alt']"/> {{ $t('timeline') }}</header>
<header><fa :icon="['far', 'comment-alt']"/> {{ $t('@.featured-notes') }}</header>
<div>
<mk-welcome-timeline class="tl" :max="20"/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/endpoints/notes/featured.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const meta = {

params: {
days: {
validator: $.optional.num.range(1, 1000),
validator: $.optional.num.range(0, 1000),
default: 2,
desc: {
'ja-JP': '最大数'
Expand Down

0 comments on commit 48d04bf

Please sign in to comment.