Merge branch 'develop'

This commit is contained in:
syuilo
2019-04-18 22:01:45 +09:00
39 changed files with 556 additions and 260 deletions

View File

@@ -123,7 +123,7 @@ export default Vue.extend({
},
fetchMore() {
if (!this.more || this.moreFetching) return;
if (!this.more || this.moreFetching || this.notes.length === 0) return;
this.moreFetching = true;
this.makePromise(this.notes[this.notes.length - 1].id).then(x => {
this.notes = this.notes.concat(x.notes);

View File

@@ -90,9 +90,8 @@
import Vue from 'vue';
import i18n from '../../../i18n';
import MkUserListsWindow from './user-lists-window.vue';
import MkUserListWindow from './user-list-window.vue';
import MkFollowRequestsWindow from './received-follow-requests-window.vue';
import MkSettingsWindow from './settings-window.vue';
// import MkSettingsWindow from './settings-window.vue';
import MkDriveWindow from './drive-window.vue';
import contains from '../../../common/scripts/contains';
import { faHome, faColumns } from '@fortawesome/free-solid-svg-icons';
@@ -143,12 +142,7 @@ export default Vue.extend({
},
list() {
this.close();
const w = this.$root.new(MkUserListsWindow);
w.$once('choosen', list => {
this.$root.new(MkUserListWindow, {
list
});
});
this.$root.new(MkUserListsWindow);
},
followRequests() {
this.close();

View File

@@ -9,6 +9,7 @@
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
import { search } from '../../../common/scripts/search';
export default Vue.extend({
i18n: i18n('desktop/views/components/ui.header.search.vue'),
@@ -22,29 +23,11 @@ export default Vue.extend({
async onSubmit() {
if (this.wait) return;
const q = this.q.trim();
if (q.startsWith('@')) {
this.$router.push(`/${q}`);
} else if (q.startsWith('#')) {
this.$router.push(`/tags/${encodeURIComponent(q.substr(1))}`);
} else if (q.startsWith('https://')) {
this.wait = true;
try {
const res = await this.$root.api('ap/show', {
uri: q
});
if (res.type == 'User') {
this.$router.push(`/@${res.object.username}@${res.object.host}`);
} else if (res.type == 'Note') {
this.$router.push(`/notes/${res.object.id}`);
}
} catch (e) {
// TODO
}
this.wait = true;
search(this, this.q).finally(() => {
this.wait = false;
} else {
this.$router.push(`/search?q=${encodeURIComponent(q)}`);
}
this.q = '';
});
}
}
});

View File

@@ -148,10 +148,7 @@ export default Vue.extend({
},
list() {
const w = this.$root.new(MkUserListsWindow);
w.$once('choosen', list => {
this.$router.push(`i/lists/${ list.id }`);
});
this.$root.new(MkUserListsWindow);
},
followRequests() {

View File

@@ -18,10 +18,12 @@ export default Vue.extend({
data() {
return {
connection: null,
date: null,
makePromise: cursor => this.$root.api('notes/user-list-timeline', {
listId: this.list.id,
limit: fetchLimit + 1,
untilId: cursor ? cursor : undefined,
untilDate: cursor ? undefined : (this.date ? this.date.getTime() : undefined),
includeMyRenotes: this.$store.state.settings.showMyRenotes,
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes,
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
@@ -46,6 +48,10 @@ export default Vue.extend({
},
mounted() {
this.init();
this.$root.$on('warp', this.warp);
this.$once('hook:beforeDestroy', () => {
this.$root.$off('warp', this.warp);
});
},
beforeDestroy() {
this.connection.dispose();
@@ -68,6 +74,10 @@ export default Vue.extend({
},
onUserRemoved() {
(this.$refs.timeline as any).reload();
},
warp(date) {
this.date = date;
(this.$refs.timeline as any).reload();
}
}
});

View File

@@ -1,85 +1,36 @@
<template>
<mk-window ref="window" width="450px" height="500px" @closed="destroyDom">
<template #header><fa icon="list"/> {{ $t('title') }}</template>
<div class="xkxvokkjlptzyewouewmceqcxhpgzprp">
<button class="ui" @click="add">{{ $t('create-list') }}</button>
<a v-for="list in lists" :key="list.id" @click="choice(list)">{{ list.name }}</a>
</div>
<x-lists :class="$style.content" @choosen="choosen"/>
</mk-window>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
import MkUserListWindow from './user-list-window.vue';
export default Vue.extend({
i18n: i18n('desktop/views/components/user-lists-window.vue'),
data() {
return {
fetching: true,
lists: []
};
},
mounted() {
this.$root.api('users/lists/list').then(lists => {
this.fetching = false;
this.lists = lists;
});
components: {
XLists: () => import('../../../common/views/components/user-lists.vue').then(m => m.default)
},
methods: {
add() {
this.$root.dialog({
title: this.$t('list-name'),
input: true
}).then(async ({ canceled, result: title }) => {
if (canceled) return;
const list = await this.$root.api('users/lists/create', {
title
});
this.$emit('choosen', list);
});
},
choice(list) {
this.$emit('choosen', list);
},
close() {
(this as any).$refs.window.close();
},
choosen(list) {
this.$root.new(MkUserListWindow, {
list
});
}
}
});
</script>
<style lang="stylus" scoped>
.xkxvokkjlptzyewouewmceqcxhpgzprp
padding 16px
> button
display block
margin-bottom 16px
color var(--primaryForeground)
background var(--primary)
width 100%
border-radius 38px
user-select none
cursor pointer
padding 0 16px
min-width 100px
line-height 38px
font-size 14px
font-weight 700
&:hover
background var(--primaryLighten10)
&:active
background var(--primaryDarken10)
> a
display block
padding 16px
border solid 1px var(--faceDivider)
border-radius 4px
<style lang="stylus" module>
.content
height 100%
overflow auto
</style>

View File

@@ -53,6 +53,12 @@ export default Vue.extend({
},
created() {
this.$root.$on('warp', this.warp);
this.$once('hook:beforeDestroy', () => {
this.$root.$off('warp', this.warp);
this.connection.dispose();
});
const prepend = note => {
(this.$refs.timeline as any).prepend(note);
};
@@ -124,13 +130,14 @@ export default Vue.extend({
});
},
beforeDestroy() {
this.connection.dispose();
},
methods: {
focus() {
(this.$refs.timeline as any).focus();
},
warp(date) {
this.date = date;
(this.$refs.timeline as any).reload();
}
}
});

View File

@@ -36,7 +36,8 @@ export default Vue.extend({
includeReplies: this.mode == 'with-replies',
includeMyRenotes: this.mode != 'my-posts',
withFiles: this.mode == 'with-media',
untilDate: cursor ? cursor : new Date().getTime() + 1000 * 86400 * 365
untilDate: cursor ? undefined : (this.date ? this.date.getTime() : undefined),
untilId: cursor ? cursor : undefined
}).then(notes => {
if (notes.length == fetchLimit + 1) {
notes.pop();
@@ -62,10 +63,11 @@ export default Vue.extend({
mounted() {
document.addEventListener('keydown', this.onDocumentKeydown);
},
beforeDestroy() {
document.removeEventListener('keydown', this.onDocumentKeydown);
this.$root.$on('warp', this.warp);
this.$once('hook:beforeDestroy', () => {
this.$root.$off('warp', this.warp);
document.removeEventListener('keydown', this.onDocumentKeydown);
});
},
methods: {

View File

@@ -11,7 +11,9 @@
<div class="mkw-polls--body">
<div class="poll" v-if="!fetching && poll != null">
<p v-if="poll.text"><router-link :to="poll | notePage">{{ poll.text }}</router-link></p>
<p v-if="poll.text"><router-link :to="poll | notePage">
<mfm :text="poll.text" :author="poll.user" :custom-emojis="poll.emojis"/>
</router-link></p>
<p v-if="!poll.text"><router-link :to="poll | notePage"><fa icon="link"/></router-link></p>
<mk-poll :note="poll"/>
</div>

View File

@@ -14,7 +14,7 @@ export default define({
}).extend({
methods: {
chosen(date) {
this.$emit('chosen', date);
this.$root.$emit('warp', date);
},
func() {
if (this.props.design == 5) {