diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-11-09 08:13:34 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-11-09 08:13:34 +0900 |
| commit | 60ef3e3563c95008bde52818a7d638d1d8ff9b19 (patch) | |
| tree | 085539a945faa4fe4105f82f65e5d320ea542b03 /src/client/app/mobile | |
| parent | Clean up (diff) | |
| download | misskey-60ef3e3563c95008bde52818a7d638d1d8ff9b19.tar.gz misskey-60ef3e3563c95008bde52818a7d638d1d8ff9b19.tar.bz2 misskey-60ef3e3563c95008bde52818a7d638d1d8ff9b19.zip | |
Refactor & Clean up
Diffstat (limited to 'src/client/app/mobile')
39 files changed, 110 insertions, 110 deletions
diff --git a/src/client/app/mobile/views/components/activity.vue b/src/client/app/mobile/views/components/activity.vue index 627bebbd32..18bff253de 100644 --- a/src/client/app/mobile/views/components/activity.vue +++ b/src/client/app/mobile/views/components/activity.vue @@ -18,7 +18,7 @@ export default Vue.extend({ }; }, mounted() { - (this as any).api('charts/user/notes', { + this.$root.api('charts/user/notes', { userId: this.user.id, span: 'day', limit: 21 diff --git a/src/client/app/mobile/views/components/drive.file-detail.vue b/src/client/app/mobile/views/components/drive.file-detail.vue index cda907fcd1..83ee03d1ea 100644 --- a/src/client/app/mobile/views/components/drive.file-detail.vue +++ b/src/client/app/mobile/views/components/drive.file-detail.vue @@ -92,7 +92,7 @@ export default Vue.extend({ rename() { const name = window.prompt(this.$t('rename'), this.file.name); if (name == null || name == '' || name == this.file.name) return; - (this as any).api('drive/files/update', { + this.$root.api('drive/files/update', { fileId: this.file.id, name: name }).then(() => { @@ -102,7 +102,7 @@ export default Vue.extend({ move() { (this as any).apis.chooseDriveFolder().then(folder => { - (this as any).api('drive/files/update', { + this.$root.api('drive/files/update', { fileId: this.file.id, folderId: folder == null ? null : folder.id }).then(() => { @@ -112,7 +112,7 @@ export default Vue.extend({ }, del() { - (this as any).api('drive/files/delete', { + this.$root.api('drive/files/delete', { fileId: this.file.id }).then(() => { this.browser.cd(this.file.folderId, true); @@ -120,7 +120,7 @@ export default Vue.extend({ }, toggleSensitive() { - (this as any).api('drive/files/update', { + this.$root.api('drive/files/update', { fileId: this.file.id, isSensitive: !this.file.isSensitive }); diff --git a/src/client/app/mobile/views/components/drive.vue b/src/client/app/mobile/views/components/drive.vue index b61af722cf..7c0a2cd74a 100644 --- a/src/client/app/mobile/views/components/drive.vue +++ b/src/client/app/mobile/views/components/drive.vue @@ -103,7 +103,7 @@ export default Vue.extend({ } }, mounted() { - this.connection = (this as any).os.stream.useSharedConnection('drive'); + this.connection = this.$root.stream.useSharedConnection('drive'); this.connection.on('fileCreated', this.onStreamDriveFileCreated); this.connection.on('fileUpdated', this.onStreamDriveFileUpdated); @@ -174,7 +174,7 @@ export default Vue.extend({ this.fetching = true; - (this as any).api('drive/folders/show', { + this.$root.api('drive/folders/show', { folderId: target }).then(folder => { this.folder = folder; @@ -269,7 +269,7 @@ export default Vue.extend({ const filesMax = 20; // フォルダ一覧取得 - (this as any).api('drive/folders', { + this.$root.api('drive/folders', { folderId: this.folder ? this.folder.id : null, limit: foldersMax + 1 }).then(folders => { @@ -282,7 +282,7 @@ export default Vue.extend({ }); // ファイル一覧取得 - (this as any).api('drive/files', { + this.$root.api('drive/files', { folderId: this.folder ? this.folder.id : null, limit: filesMax + 1 }).then(files => { @@ -312,7 +312,7 @@ export default Vue.extend({ if (this.folder == null) { // Fetch addtional drive info - (this as any).api('drive').then(info => { + this.$root.api('drive').then(info => { this.info = info; }); } @@ -325,7 +325,7 @@ export default Vue.extend({ const max = 30; // ファイル一覧取得 - (this as any).api('drive/files', { + this.$root.api('drive/files', { folderId: this.folder ? this.folder.id : null, limit: max + 1, untilId: this.files[this.files.length - 1].id @@ -364,7 +364,7 @@ export default Vue.extend({ this.fetching = true; - (this as any).api('drive/files/show', { + this.$root.api('drive/files/show', { fileId: file }).then(file => { this.file = file; @@ -411,7 +411,7 @@ export default Vue.extend({ createFolder() { const name = window.prompt(this.$t('folder-name')); if (name == null || name == '') return; - (this as any).api('drive/folders/create', { + this.$root.api('drive/folders/create', { name: name, parentId: this.folder ? this.folder.id : undefined }).then(folder => { @@ -426,7 +426,7 @@ export default Vue.extend({ } const name = window.prompt(this.$t('folder-name'), this.folder.name); if (name == null || name == '') return; - (this as any).api('drive/folders/update', { + this.$root.api('drive/folders/update', { name: name, folderId: this.folder.id }).then(folder => { @@ -440,7 +440,7 @@ export default Vue.extend({ return; } (this as any).apis.chooseDriveFolder().then(folder => { - (this as any).api('drive/folders/update', { + this.$root.api('drive/folders/update', { parentId: folder ? folder.id : null, folderId: this.folder.id }).then(folder => { @@ -452,7 +452,7 @@ export default Vue.extend({ urlUpload() { const url = window.prompt(this.$t('url-prompt')); if (url == null || url == '') return; - (this as any).api('drive/files/upload_from_url', { + this.$root.api('drive/files/upload_from_url', { url: url, folderId: this.folder ? this.folder.id : undefined }); diff --git a/src/client/app/mobile/views/components/follow-button.vue b/src/client/app/mobile/views/components/follow-button.vue index a13e2fab95..00e96082ce 100644 --- a/src/client/app/mobile/views/components/follow-button.vue +++ b/src/client/app/mobile/views/components/follow-button.vue @@ -37,7 +37,7 @@ export default Vue.extend({ }, mounted() { - this.connection = (this as any).os.stream.useSharedConnection('main'); + this.connection = this.$root.stream.useSharedConnection('main'); this.connection.on('follow', this.onFollowChange); this.connection.on('unfollow', this.onFollowChange); @@ -61,20 +61,20 @@ export default Vue.extend({ try { if (this.u.isFollowing) { - this.u = await (this as any).api('following/delete', { + this.u = await this.$root.api('following/delete', { userId: this.u.id }); } else { if (this.u.hasPendingFollowRequestFromYou) { - this.u = await (this as any).api('following/requests/cancel', { + this.u = await this.$root.api('following/requests/cancel', { userId: this.u.id }); } else if (this.u.isLocked) { - this.u = await (this as any).api('following/create', { + this.u = await this.$root.api('following/create', { userId: this.u.id }); } else { - this.u = await (this as any).api('following/create', { + this.u = await this.$root.api('following/create', { userId: this.user.id }); } diff --git a/src/client/app/mobile/views/components/friends-maker.vue b/src/client/app/mobile/views/components/friends-maker.vue index d1b9690d68..316b6b0701 100644 --- a/src/client/app/mobile/views/components/friends-maker.vue +++ b/src/client/app/mobile/views/components/friends-maker.vue @@ -32,7 +32,7 @@ export default Vue.extend({ this.fetching = true; this.users = []; - (this as any).api('users/recommendation', { + this.$root.api('users/recommendation', { limit: this.limit, offset: this.limit * this.page }).then(users => { diff --git a/src/client/app/mobile/views/components/media-image.vue b/src/client/app/mobile/views/components/media-image.vue index ddbe4cb401..4d46516767 100644 --- a/src/client/app/mobile/views/components/media-image.vue +++ b/src/client/app/mobile/views/components/media-image.vue @@ -47,7 +47,7 @@ export default Vue.extend({ }, methods: { onClick() { - (this as any).os.new(ImageViewer, { + this.$root.new(ImageViewer, { image: this.image }); } diff --git a/src/client/app/mobile/views/components/note-detail.vue b/src/client/app/mobile/views/components/note-detail.vue index 2931f5c36c..f6cbc82dd8 100644 --- a/src/client/app/mobile/views/components/note-detail.vue +++ b/src/client/app/mobile/views/components/note-detail.vue @@ -155,7 +155,7 @@ export default Vue.extend({ mounted() { // Get replies if (!this.compact) { - (this as any).api('notes/replies', { + this.$root.api('notes/replies', { noteId: this.p.id, limit: 8 }).then(replies => { @@ -167,7 +167,7 @@ export default Vue.extend({ if (this.p.geo) { const shouldShowMap = this.$store.getters.isSignedIn ? this.$store.state.settings.showMaps : true; if (shouldShowMap) { - (this as any).os.getGoogleMaps().then(maps => { + this.$root.os.getGoogleMaps().then(maps => { const uluru = new maps.LatLng(this.p.geo.coordinates[1], this.p.geo.coordinates[0]); const map = new maps.Map(this.$refs.map, { center: uluru, @@ -187,7 +187,7 @@ export default Vue.extend({ this.conversationFetching = true; // Fetch conversation - (this as any).api('notes/conversation', { + this.$root.api('notes/conversation', { noteId: this.p.replyId }).then(conversation => { this.conversationFetching = false; @@ -208,7 +208,7 @@ export default Vue.extend({ }, react() { - (this as any).os.new(MkReactionPicker, { + this.$root.new(MkReactionPicker, { source: this.$refs.reactButton, note: this.p, compact: true, @@ -217,7 +217,7 @@ export default Vue.extend({ }, menu() { - (this as any).os.new(MkNoteMenu, { + this.$root.new(MkNoteMenu, { source: this.$refs.menuButton, note: this.p, compact: true diff --git a/src/client/app/mobile/views/components/notifications.vue b/src/client/app/mobile/views/components/notifications.vue index 3a95e0d158..17d6e45336 100644 --- a/src/client/app/mobile/views/components/notifications.vue +++ b/src/client/app/mobile/views/components/notifications.vue @@ -57,13 +57,13 @@ export default Vue.extend({ mounted() { window.addEventListener('scroll', this.onScroll, { passive: true }); - this.connection = (this as any).os.stream.useSharedConnection('main'); + this.connection = this.$root.stream.useSharedConnection('main'); this.connection.on('notification', this.onNotification); const max = 10; - (this as any).api('i/notifications', { + this.$root.api('i/notifications', { limit: max + 1 }).then(notifications => { if (notifications.length == max + 1) { @@ -90,7 +90,7 @@ export default Vue.extend({ const max = 30; - (this as any).api('i/notifications', { + this.$root.api('i/notifications', { limit: max + 1, untilId: this.notifications[this.notifications.length - 1].id }).then(notifications => { @@ -107,7 +107,7 @@ export default Vue.extend({ onNotification(notification) { // TODO: ユーザーが画面を見てないと思われるとき(ブラウザやタブがアクティブじゃないなど)は送信しない - (this as any).os.stream.send('readNotification', { + this.$root.stream.send('readNotification', { id: notification.id }); diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue index 8715046acb..a6e50934a9 100644 --- a/src/client/app/mobile/views/components/post-form.vue +++ b/src/client/app/mobile/views/components/post-form.vue @@ -110,7 +110,7 @@ export default Vue.extend({ }, created() { - (this as any).os.getMeta().then(meta => { + this.$root.getMeta().then(meta => { this.maxNoteTextLength = meta.maxNoteTextLength; }); }, @@ -190,7 +190,7 @@ export default Vue.extend({ // ダイレクトへのリプライはリプライ先ユーザーを初期設定 if (this.reply && this.reply.visibility === 'specified') { - (this as any).api('users/show', { userId: this.reply.userId }).then(user => { + this.$root.api('users/show', { userId: this.reply.userId }).then(user => { this.visibleUsers.push(user); }); } @@ -269,7 +269,7 @@ export default Vue.extend({ }, setVisibility() { - const w = (this as any).os.new(MkVisibilityChooser, { + const w = this.$root.new(MkVisibilityChooser, { source: this.$refs.visibilityButton, compact: true }); @@ -283,7 +283,7 @@ export default Vue.extend({ title: this.$t('username-prompt') }).then(acct => { if (acct.startsWith('@')) acct = acct.substr(1); - (this as any).api('users/show', parseAcct(acct)).then(user => { + this.$root.api('users/show', parseAcct(acct)).then(user => { this.visibleUsers.push(user); }); }); @@ -303,7 +303,7 @@ export default Vue.extend({ post() { this.posting = true; const viaMobile = this.$store.state.settings.disableViaMobile !== true; - (this as any).api('notes/create', { + this.$root.api('notes/create', { text: this.text == '' ? undefined : this.text, fileIds: this.files.length > 0 ? this.files.map(f => f.id) : undefined, replyId: this.reply ? this.reply.id : undefined, diff --git a/src/client/app/mobile/views/components/ui.header.vue b/src/client/app/mobile/views/components/ui.header.vue index 9dbc1f9d02..f5b9161286 100644 --- a/src/client/app/mobile/views/components/ui.header.vue +++ b/src/client/app/mobile/views/components/ui.header.vue @@ -48,7 +48,7 @@ export default Vue.extend({ this.$store.commit('setUiHeaderHeight', this.$refs.root.offsetHeight); if (this.$store.getters.isSignedIn) { - this.connection = (this as any).os.stream.useSharedConnection('main'); + this.connection = this.$root.stream.useSharedConnection('main'); this.connection.on('reversiInvited', this.onReversiInvited); this.connection.on('reversi_no_invites', this.onReversiNoInvites); diff --git a/src/client/app/mobile/views/components/ui.nav.vue b/src/client/app/mobile/views/components/ui.nav.vue index 5a582c7aca..c529ae2617 100644 --- a/src/client/app/mobile/views/components/ui.nav.vue +++ b/src/client/app/mobile/views/components/ui.nav.vue @@ -75,12 +75,12 @@ export default Vue.extend({ }, mounted() { - (this as any).os.getMeta().then(meta => { + this.$root.getMeta().then(meta => { this.announcements = meta.broadcasts; }); if (this.$store.getters.isSignedIn) { - this.connection = (this as any).os.stream.useSharedConnection('main'); + this.connection = this.$root.stream.useSharedConnection('main'); this.connection.on('reversiInvited', this.onReversiInvited); this.connection.on('reversi_no_invites', this.onReversiNoInvites); diff --git a/src/client/app/mobile/views/components/ui.vue b/src/client/app/mobile/views/components/ui.vue index 6f77f44454..f93c0d686b 100644 --- a/src/client/app/mobile/views/components/ui.vue +++ b/src/client/app/mobile/views/components/ui.vue @@ -43,7 +43,7 @@ export default Vue.extend({ this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px'; if (this.$store.getters.isSignedIn) { - this.connection = (this as any).os.stream.useSharedConnection('main'); + this.connection = this.$root.stream.useSharedConnection('main'); this.connection.on('notification', this.onNotification); } @@ -58,11 +58,11 @@ export default Vue.extend({ methods: { onNotification(notification) { // TODO: ユーザーが画面を見てないと思われるとき(ブラウザやタブがアクティブじゃないなど)は送信しない - (this as any).os.stream.send('readNotification', { + this.$root.stream.send('readNotification', { id: notification.id }); - (this as any).os.new(MkNotify, { + this.$root.new(MkNotify, { notification }); } diff --git a/src/client/app/mobile/views/components/user-list-timeline.vue b/src/client/app/mobile/views/components/user-list-timeline.vue index f0137d5df4..a9597319df 100644 --- a/src/client/app/mobile/views/components/user-list-timeline.vue +++ b/src/client/app/mobile/views/components/user-list-timeline.vue @@ -42,7 +42,7 @@ export default Vue.extend({ methods: { init() { if (this.connection) this.connection.dispose(); - this.connection = (this as any).os.stream.connectToChannel('userList', { + this.connection = this.$root.stream.connectToChannel('userList', { listId: this.list.id }); this.connection.on('note', this.onNote); @@ -56,7 +56,7 @@ export default Vue.extend({ this.fetching = true; (this.$refs.timeline as any).init(() => new Promise((res, rej) => { - (this as any).api('notes/user-list-timeline', { + this.$root.api('notes/user-list-timeline', { listId: this.list.id, limit: fetchLimit + 1, includeMyRenotes: this.$store.state.settings.showMyRenotes, @@ -79,7 +79,7 @@ export default Vue.extend({ this.moreFetching = true; - const promise = (this as any).api('notes/user-list-timeline', { + const promise = this.$root.api('notes/user-list-timeline', { listId: this.list.id, limit: fetchLimit + 1, untilId: (this.$refs.timeline as any).tail().id, diff --git a/src/client/app/mobile/views/components/user-timeline.vue b/src/client/app/mobile/views/components/user-timeline.vue index cfe1522666..6773b75763 100644 --- a/src/client/app/mobile/views/components/user-timeline.vue +++ b/src/client/app/mobile/views/components/user-timeline.vue @@ -41,7 +41,7 @@ export default Vue.extend({ fetch() { this.fetching = true; (this.$refs.timeline as any).init(() => new Promise((res, rej) => { - (this as any).api('users/notes', { + this.$root.api('users/notes', { userId: this.user.id, withFiles: this.withMedia, limit: fetchLimit + 1 @@ -62,7 +62,7 @@ export default Vue.extend({ this.moreFetching = true; - const promise = (this as any).api('users/notes', { + const promise = this.$root.api('users/notes', { userId: this.user.id, withFiles: this.withMedia, limit: fetchLimit + 1, diff --git a/src/client/app/mobile/views/pages/drive.vue b/src/client/app/mobile/views/pages/drive.vue index e9197bcfcf..ac207f1d51 100644 --- a/src/client/app/mobile/views/pages/drive.vue +++ b/src/client/app/mobile/views/pages/drive.vue @@ -45,7 +45,7 @@ export default Vue.extend({ window.addEventListener('popstate', this.onPopState); }, mounted() { - document.title = `${(this as any).os.instanceName} Drive`; + document.title = `${this.$root.os.instanceName} Drive`; }, beforeDestroy() { window.removeEventListener('popstate', this.onPopState); @@ -64,7 +64,7 @@ export default Vue.extend({ (this.$refs as any).browser.openContextMenu(); }, onMoveRoot(silent) { - const title = `${(this as any).os.instanceName} Drive`; + const title = `${this.$root.os.instanceName} Drive`; if (!silent) { // Rewrite URL @@ -77,7 +77,7 @@ export default Vue.extend({ this.folder = null; }, onOpenFolder(folder, silent) { - const title = `${folder.name} | ${(this as any).os.instanceName} Drive`; + const title = `${folder.name} | ${this.$root.os.instanceName} Drive`; if (!silent) { // Rewrite URL @@ -90,7 +90,7 @@ export default Vue.extend({ this.folder = folder; }, onOpenFile(file, silent) { - const title = `${file.name} | ${(this as any).os.instanceName} Drive`; + const title = `${file.name} | ${this.$root.os.instanceName} Drive`; if (!silent) { // Rewrite URL diff --git a/src/client/app/mobile/views/pages/favorites.vue b/src/client/app/mobile/views/pages/favorites.vue index ff652ddf0b..35f639ec05 100644 --- a/src/client/app/mobile/views/pages/favorites.vue +++ b/src/client/app/mobile/views/pages/favorites.vue @@ -30,14 +30,14 @@ export default Vue.extend({ this.fetch(); }, mounted() { - document.title = `${(this as any).os.instanceName} | %i18n:@notifications%`; + document.title = `${this.$root.os.instanceName} | %i18n:@notifications%`; }, methods: { fetch() { Progress.start(); this.fetching = true; - (this as any).api('i/favorites', { + this.$root.api('i/favorites', { limit: 11 }).then(favorites => { if (favorites.length == 11) { @@ -53,7 +53,7 @@ export default Vue.extend({ }, more() { this.moreFetching = true; - (this as any).api('i/favorites', { + this.$root.api('i/favorites', { limit: 11, untilId: this.favorites[this.favorites.length - 1].id }).then(favorites => { diff --git a/src/client/app/mobile/views/pages/followers.vue b/src/client/app/mobile/views/pages/followers.vue index b92c0088fb..4d69d2cf5c 100644 --- a/src/client/app/mobile/views/pages/followers.vue +++ b/src/client/app/mobile/views/pages/followers.vue @@ -46,18 +46,18 @@ export default Vue.extend({ Progress.start(); this.fetching = true; - (this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => { + this.$root.api('users/show', parseAcct(this.$route.params.user)).then(user => { this.user = user; this.fetching = false; - document.title = `${this.$t('followers-of').replace('{}', this.name)} | ${(this as any).os.instanceName}`; + document.title = `${this.$t('followers-of').replace('{}', this.name)} | ${this.$root.os.instanceName}`; }); }, onLoaded() { Progress.done(); }, fetchUsers(iknow, limit, cursor, cb) { - (this as any).api('users/followers', { + this.$root.api('users/followers', { userId: this.user.id, iknow: iknow, limit: limit, diff --git a/src/client/app/mobile/views/pages/following.vue b/src/client/app/mobile/views/pages/following.vue index a4ec0ab6c7..52f74eff29 100644 --- a/src/client/app/mobile/views/pages/following.vue +++ b/src/client/app/mobile/views/pages/following.vue @@ -45,18 +45,18 @@ export default Vue.extend({ Progress.start(); this.fetching = true; - (this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => { + this.$root.api('users/show', parseAcct(this.$route.params.user)).then(user => { this.user = user; this.fetching = false; - document.title = `${this.$t('followers-of').replace('{}', this.name)} | ${(this as any).os.instanceName}`; + document.title = `${this.$t('followers-of').replace('{}', this.name)} | ${this.$root.os.instanceName}`; }); }, onLoaded() { Progress.done(); }, fetchUsers(iknow, limit, cursor, cb) { - (this as any).api('users/following', { + this.$root.api('users/following', { userId: this.user.id, iknow: iknow, limit: limit, diff --git a/src/client/app/mobile/views/pages/games/reversi.vue b/src/client/app/mobile/views/pages/games/reversi.vue index 8a5653fc6e..4663ec7f19 100644 --- a/src/client/app/mobile/views/pages/games/reversi.vue +++ b/src/client/app/mobile/views/pages/games/reversi.vue @@ -15,7 +15,7 @@ export default Vue.extend({ XReversi: () => import('../../../../common/views/components/games/reversi/reversi.vue') }, mounted() { - document.title = `${(this as any).os.instanceName} %i18n:@reversi%`; + document.title = `${this.$root.os.instanceName} %i18n:@reversi%`; }, methods: { nav(game, actualNav) { diff --git a/src/client/app/mobile/views/pages/home.timeline.vue b/src/client/app/mobile/views/pages/home.timeline.vue index 4f28d23c09..0699a169e4 100644 --- a/src/client/app/mobile/views/pages/home.timeline.vue +++ b/src/client/app/mobile/views/pages/home.timeline.vue @@ -66,32 +66,32 @@ export default Vue.extend({ this.query = { query: this.tagTl.query }; - this.connection = (this as any).os.stream.connectToChannel('hashtag', { q: this.tagTl.query }); + this.connection = this.$root.stream.connectToChannel('hashtag', { q: this.tagTl.query }); this.connection.on('note', prepend); } else if (this.src == 'home') { this.endpoint = 'notes/timeline'; const onChangeFollowing = () => { this.fetch(); }; - this.connection = (this as any).os.stream.useSharedConnection('homeTimeline'); + this.connection = this.$root.stream.useSharedConnection('homeTimeline'); this.connection.on('note', prepend); this.connection.on('follow', onChangeFollowing); this.connection.on('unfollow', onChangeFollowing); } else if (this.src == 'local') { this.endpoint = 'notes/local-timeline'; - this.connection = (this as any).os.stream.useSharedConnection('localTimeline'); + this.connection = this.$root.stream.useSharedConnection('localTimeline'); this.connection.on('note', prepend); } else if (this.src == 'hybrid') { this.endpoint = 'notes/hybrid-timeline'; - this.connection = (this as any).os.stream.useSharedConnection('hybridTimeline'); + this.connection = this.$root.stream.useSharedConnection('hybridTimeline'); this.connection.on('note', prepend); } else if (this.src == 'global') { this.endpoint = 'notes/global-timeline'; - this.connection = (this as any).os.stream.useSharedConnection('globalTimeline'); + this.connection = this.$root.stream.useSharedConnection('globalTimeline'); this.connection.on('note', prepend); } else if (this.src == 'mentions') { this.endpoint = 'notes/mentions'; - this.connection = (this as any).os.stream.useSharedConnection('main'); + this.connection = this.$root.stream.useSharedConnection('main'); this.connection.on('mention', prepend); } else if (this.src == 'messages') { this.endpoint = 'notes/mentions'; @@ -103,7 +103,7 @@ export default Vue.extend({ prepend(note); } }; - this.connection = (this as any).os.stream.useSharedConnection('main'); + this.connection = this.$root.stream.useSharedConnection('main'); this.connection.on('mention', onNote); } @@ -119,7 +119,7 @@ export default Vue.extend({ this.fetching = true; (this.$refs.timeline as any).init(() => new Promise((res, rej) => { - (this as any).api(this.endpoint, Object.assign({ + this.$root.api(this.endpoint, Object.assign({ limit: fetchLimit + 1, untilDate: this.date ? this.date.getTime() : undefined }, this.baseQuery, this.query)).then(notes => { @@ -139,7 +139,7 @@ export default Vue.extend({ this.moreFetching = true; - const promise = (this as any).api(this.endpoint, Object.assign({ + const promise = this.$root.api(this.endpoint, Object.assign({ limit: fetchLimit + 1, untilId: (this.$refs.timeline as any).tail().id }, this.baseQuery, this.query)); diff --git a/src/client/app/mobile/views/pages/home.vue b/src/client/app/mobile/views/pages/home.vue index d197f1a44f..8849397df1 100644 --- a/src/client/app/mobile/views/pages/home.vue +++ b/src/client/app/mobile/views/pages/home.vue @@ -103,7 +103,7 @@ export default Vue.extend({ showNav(v) { if (v && this.lists === null) { - (this as any).api('users/lists/list').then(lists => { + this.$root.api('users/lists/list').then(lists => { this.lists = lists; }); } @@ -111,7 +111,7 @@ export default Vue.extend({ }, created() { - (this as any).os.getMeta().then(meta => { + this.$root.getMeta().then(meta => { this.enableLocalTimeline = !meta.disableLocalTimeline; }); @@ -128,7 +128,7 @@ export default Vue.extend({ }, mounted() { - document.title = (this as any).os.instanceName; + document.title = this.$root.os.instanceName; Progress.start(); diff --git a/src/client/app/mobile/views/pages/messaging-room.vue b/src/client/app/mobile/views/pages/messaging-room.vue index 64feba43a2..784c1fcaa5 100644 --- a/src/client/app/mobile/views/pages/messaging-room.vue +++ b/src/client/app/mobile/views/pages/messaging-room.vue @@ -45,11 +45,11 @@ export default Vue.extend({ methods: { fetch() { this.fetching = true; - (this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => { + this.$root.api('users/show', parseAcct(this.$route.params.user)).then(user => { this.user = user; this.fetching = false; - document.title = `${this.$t('@.messaging')}: ${Vue.filter('userName')(this.user)} | ${(this as any).os.instanceName}`; + document.title = `${this.$t('@.messaging')}: ${Vue.filter('userName')(this.user)} | ${this.$root.os.instanceName}`; }); } } diff --git a/src/client/app/mobile/views/pages/messaging.vue b/src/client/app/mobile/views/pages/messaging.vue index 790d2a6254..59b5410286 100644 --- a/src/client/app/mobile/views/pages/messaging.vue +++ b/src/client/app/mobile/views/pages/messaging.vue @@ -13,7 +13,7 @@ import getAcct from '../../../../../misc/acct/render'; export default Vue.extend({ i18n: i18n(), mounted() { - document.title = `${(this as any).os.instanceName} ${this.$t('@.messaging')}`; + document.title = `${this.$root.os.instanceName} ${this.$t('@.messaging')}`; }, methods: { navigate(user) { diff --git a/src/client/app/mobile/views/pages/note.vue b/src/client/app/mobile/views/pages/note.vue index efe9c0c0ff..a0449298eb 100644 --- a/src/client/app/mobile/views/pages/note.vue +++ b/src/client/app/mobile/views/pages/note.vue @@ -33,14 +33,14 @@ export default Vue.extend({ this.fetch(); }, mounted() { - document.title = (this as any).os.instanceName; + document.title = this.$root.os.instanceName; }, methods: { fetch() { Progress.start(); this.fetching = true; - (this as any).api('notes/show', { + this.$root.api('notes/show', { noteId: this.$route.params.note }).then(note => { this.note = note; diff --git a/src/client/app/mobile/views/pages/notifications.vue b/src/client/app/mobile/views/pages/notifications.vue index 8fc61ad3cb..97fe995535 100644 --- a/src/client/app/mobile/views/pages/notifications.vue +++ b/src/client/app/mobile/views/pages/notifications.vue @@ -26,7 +26,7 @@ export default Vue.extend({ const ok = window.confirm(this.$t('read-all')); if (!ok) return; - (this as any).api('notifications/mark_all_as_read'); + this.$root.api('notifications/mark_all_as_read'); }, onFetched() { Progress.done(); diff --git a/src/client/app/mobile/views/pages/received-follow-requests.vue b/src/client/app/mobile/views/pages/received-follow-requests.vue index 08fe787921..48c46f64cd 100644 --- a/src/client/app/mobile/views/pages/received-follow-requests.vue +++ b/src/client/app/mobile/views/pages/received-follow-requests.vue @@ -31,7 +31,7 @@ export default Vue.extend({ Progress.start(); - (this as any).api('following/requests/list').then(requests => { + this.$root.api('following/requests/list').then(requests => { this.fetching = false; this.requests = requests; @@ -40,12 +40,12 @@ export default Vue.extend({ }, methods: { accept(user) { - (this as any).api('following/requests/accept', { userId: user.id }).then(() => { + this.$root.api('following/requests/accept', { userId: user.id }).then(() => { this.requests = this.requests.filter(r => r.follower.id != user.id); }); }, reject(user) { - (this as any).api('following/requests/reject', { userId: user.id }).then(() => { + this.$root.api('following/requests/reject', { userId: user.id }).then(() => { this.requests = this.requests.filter(r => r.follower.id != user.id); }); } diff --git a/src/client/app/mobile/views/pages/search.vue b/src/client/app/mobile/views/pages/search.vue index 13b0469933..00723c26fd 100644 --- a/src/client/app/mobile/views/pages/search.vue +++ b/src/client/app/mobile/views/pages/search.vue @@ -36,7 +36,7 @@ export default Vue.extend({ } }, mounted() { - document.title = `%i18n:@search%: ${this.q} | ${(this as any).os.instanceName}`; + document.title = `%i18n:@search%: ${this.q} | ${this.$root.os.instanceName}`; this.fetch(); }, @@ -46,7 +46,7 @@ export default Vue.extend({ Progress.start(); (this.$refs.timeline as any).init(() => new Promise((res, rej) => { - (this as any).api('notes/search', { + this.$root.api('notes/search', { limit: limit + 1, offset: this.offset, query: this.q @@ -65,7 +65,7 @@ export default Vue.extend({ more() { this.offset += limit; - const promise = (this as any).api('notes/search', { + const promise = this.$root.api('notes/search', { limit: limit + 1, offset: this.offset, query: this.q diff --git a/src/client/app/mobile/views/pages/settings.vue b/src/client/app/mobile/views/pages/settings.vue index 702e5879e9..bc1af8c57d 100644 --- a/src/client/app/mobile/views/pages/settings.vue +++ b/src/client/app/mobile/views/pages/settings.vue @@ -334,7 +334,7 @@ export default Vue.extend({ methods: { signout() { - (this as any).os.signout(); + this.$root.os.signout(); }, checkForUpdate() { diff --git a/src/client/app/mobile/views/pages/share.vue b/src/client/app/mobile/views/pages/share.vue index 83535b39c1..6eabbef18e 100644 --- a/src/client/app/mobile/views/pages/share.vue +++ b/src/client/app/mobile/views/pages/share.vue @@ -29,7 +29,7 @@ export default Vue.extend({ } }, mounted() { - (this as any).os.getMeta().then(meta => { + this.$root.getMeta().then(meta => { this.name = meta.name; }); } diff --git a/src/client/app/mobile/views/pages/tag.vue b/src/client/app/mobile/views/pages/tag.vue index 9a0c891920..aaf878ce45 100644 --- a/src/client/app/mobile/views/pages/tag.vue +++ b/src/client/app/mobile/views/pages/tag.vue @@ -41,7 +41,7 @@ export default Vue.extend({ Progress.start(); (this.$refs.timeline as any).init(() => new Promise((res, rej) => { - (this as any).api('notes/search_by_tag', { + this.$root.api('notes/search_by_tag', { limit: limit + 1, offset: this.offset, tag: this.$route.params.tag @@ -60,7 +60,7 @@ export default Vue.extend({ more() { this.offset += limit; - const promise = (this as any).api('notes/search_by_tag', { + const promise = this.$root.api('notes/search_by_tag', { limit: limit + 1, offset: this.offset, tag: this.$route.params.tag diff --git a/src/client/app/mobile/views/pages/user-list.vue b/src/client/app/mobile/views/pages/user-list.vue index 064da3ac3a..fdc621ef7d 100644 --- a/src/client/app/mobile/views/pages/user-list.vue +++ b/src/client/app/mobile/views/pages/user-list.vue @@ -33,7 +33,7 @@ export default Vue.extend({ Progress.start(); this.fetching = true; - (this as any).api('users/lists/show', { + this.$root.api('users/lists/show', { listId: this.$route.params.list }).then(list => { this.list = list; @@ -41,7 +41,7 @@ export default Vue.extend({ Progress.done(); - (this as any).api('users/show', { + this.$root.api('users/show', { userIds: this.list.userIds }).then(users => { this.users = users; diff --git a/src/client/app/mobile/views/pages/user-lists.vue b/src/client/app/mobile/views/pages/user-lists.vue index 3844bbbf7e..5cd9d144db 100644 --- a/src/client/app/mobile/views/pages/user-lists.vue +++ b/src/client/app/mobile/views/pages/user-lists.vue @@ -29,7 +29,7 @@ export default Vue.extend({ Progress.start(); - (this as any).api('users/lists/list').then(lists => { + this.$root.api('users/lists/list').then(lists => { this.fetching = false; this.lists = lists; @@ -41,7 +41,7 @@ export default Vue.extend({ (this as any).apis.input({ title: this.$t('enter-list-name'), }).then(async title => { - const list = await (this as any).api('users/lists/create', { + const list = await this.$root.api('users/lists/create', { title }); diff --git a/src/client/app/mobile/views/pages/user.vue b/src/client/app/mobile/views/pages/user.vue index 9e79115896..5b915bc1e1 100644 --- a/src/client/app/mobile/views/pages/user.vue +++ b/src/client/app/mobile/views/pages/user.vue @@ -105,12 +105,12 @@ export default Vue.extend({ fetch() { Progress.start(); - (this as any).api('users/show', parseAcct(this.$route.params.user)).then(user => { + this.$root.api('users/show', parseAcct(this.$route.params.user)).then(user => { this.user = user; this.fetching = false; Progress.done(); - document.title = `${Vue.filter('userName')(this.user)} | ${(this as any).os.instanceName}`; + document.title = `${Vue.filter('userName')(this.user)} | ${this.$root.os.instanceName}`; }); }, @@ -120,7 +120,7 @@ export default Vue.extend({ text: this.user.isMuted ? this.$t('unmute') : this.$t('mute'), action: () => { if (this.user.isMuted) { - (this as any).api('mute/delete', { + this.$root.api('mute/delete', { userId: this.user.id }).then(() => { this.user.isMuted = false; @@ -128,7 +128,7 @@ export default Vue.extend({ alert('error'); }); } else { - (this as any).api('mute/create', { + this.$root.api('mute/create', { userId: this.user.id }).then(() => { this.user.isMuted = true; @@ -142,7 +142,7 @@ export default Vue.extend({ text: this.user.isBlocking ? this.$t('unblock') : this.$t('block'), action: () => { if (this.user.isBlocking) { - (this as any).api('blocking/delete', { + this.$root.api('blocking/delete', { userId: this.user.id }).then(() => { this.user.isBlocking = false; @@ -150,7 +150,7 @@ export default Vue.extend({ alert('error'); }); } else { - (this as any).api('blocking/create', { + this.$root.api('blocking/create', { userId: this.user.id }).then(() => { this.user.isBlocking = true; @@ -161,7 +161,7 @@ export default Vue.extend({ } }]; - this.os.new(Menu, { + this.$root.new(Menu, { source: this.$refs.menu, compact: true, items: menu diff --git a/src/client/app/mobile/views/pages/user/home.followers-you-know.vue b/src/client/app/mobile/views/pages/user/home.followers-you-know.vue index 938a565aef..60f8d74c69 100644 --- a/src/client/app/mobile/views/pages/user/home.followers-you-know.vue +++ b/src/client/app/mobile/views/pages/user/home.followers-you-know.vue @@ -24,7 +24,7 @@ export default Vue.extend({ }; }, mounted() { - (this as any).api('users/followers', { + this.$root.api('users/followers', { userId: this.user.id, iknow: true, limit: 30 diff --git a/src/client/app/mobile/views/pages/user/home.friends.vue b/src/client/app/mobile/views/pages/user/home.friends.vue index d18a1e049e..5b1af95db6 100644 --- a/src/client/app/mobile/views/pages/user/home.friends.vue +++ b/src/client/app/mobile/views/pages/user/home.friends.vue @@ -21,7 +21,7 @@ export default Vue.extend({ }; }, mounted() { - (this as any).api('users/get_frequently_replied_users', { + this.$root.api('users/get_frequently_replied_users', { userId: this.user.id }).then(res => { this.users = res.map(x => x.user); diff --git a/src/client/app/mobile/views/pages/user/home.notes.vue b/src/client/app/mobile/views/pages/user/home.notes.vue index d2ffa275a5..d01292b619 100644 --- a/src/client/app/mobile/views/pages/user/home.notes.vue +++ b/src/client/app/mobile/views/pages/user/home.notes.vue @@ -21,7 +21,7 @@ export default Vue.extend({ }; }, mounted() { - (this as any).api('users/notes', { + this.$root.api('users/notes', { userId: this.user.id }).then(notes => { this.notes = notes; diff --git a/src/client/app/mobile/views/pages/user/home.photos.vue b/src/client/app/mobile/views/pages/user/home.photos.vue index 6aa78a5414..e1d9d0470b 100644 --- a/src/client/app/mobile/views/pages/user/home.photos.vue +++ b/src/client/app/mobile/views/pages/user/home.photos.vue @@ -26,7 +26,7 @@ export default Vue.extend({ }; }, mounted() { - (this as any).api('users/notes', { + this.$root.api('users/notes', { userId: this.user.id, withFiles: true, limit: 6 diff --git a/src/client/app/mobile/views/pages/welcome.vue b/src/client/app/mobile/views/pages/welcome.vue index c09ba1a78a..585bd4062b 100644 --- a/src/client/app/mobile/views/pages/welcome.vue +++ b/src/client/app/mobile/views/pages/welcome.vue @@ -93,7 +93,7 @@ export default Vue.extend({ }; }, created() { - (this as any).os.getMeta().then(meta => { + this.$root.getMeta().then(meta => { this.meta = meta; this.name = meta.name; this.description = meta.description; @@ -101,7 +101,7 @@ export default Vue.extend({ this.banner = meta.bannerUrl; }); - (this as any).api('stats').then(stats => { + this.$root.api('stats').then(stats => { this.stats = stats; }); @@ -111,7 +111,7 @@ export default Vue.extend({ 'image/gif' ]; - (this as any).api('notes/local-timeline', { + this.$root.api('notes/local-timeline', { fileType: image, excludeNsfw: true, limit: 6 diff --git a/src/client/app/mobile/views/pages/widgets.vue b/src/client/app/mobile/views/pages/widgets.vue index be6604b8a9..739d6ecadd 100644 --- a/src/client/app/mobile/views/pages/widgets.vue +++ b/src/client/app/mobile/views/pages/widgets.vue @@ -104,7 +104,7 @@ export default Vue.extend({ }, mounted() { - document.title = (this as any).os.instanceName; + document.title = this.$root.os.instanceName; }, methods: { @@ -135,7 +135,7 @@ export default Vue.extend({ saveHome() { this.$store.commit('settings/setMobileHome', this.widgets); - (this as any).api('i/update_mobile_home', { + this.$root.api('i/update_mobile_home', { home: this.widgets }); } |