From f91a53d8936d9c387630c6ae4a313002a061a3c9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 26 May 2018 13:23:58 +0900 Subject: [PATCH 001/369] Update dependencies :rocket: --- package.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 534b0c296..e67b33ceb 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "css-loader": "0.28.11", "debug": "3.1.0", "deep-equal": "1.0.1", - "deepcopy": "0.6.3", + "deepcopy": "1.0.0", "diskusage": "0.2.4", "dompurify": "1.0.4", "elasticsearch": "15.0.0", @@ -114,7 +114,7 @@ "gulp-cssnano": "2.1.3", "gulp-htmlmin": "4.0.0", "gulp-imagemin": "4.1.0", - "gulp-mocha": "5.0.0", + "gulp-mocha": "6.0.0", "gulp-pug": "4.0.1", "gulp-rename": "1.2.3", "gulp-replace": "1.0.0", @@ -124,17 +124,17 @@ "gulp-typescript": "4.0.2", "gulp-uglify": "3.0.0", "gulp-util": "3.0.8", - "hard-source-webpack-plugin": "0.6.9", + "hard-source-webpack-plugin": "0.6.10", "highlight.js": "9.12.0", - "html-minifier": "3.5.15", + "html-minifier": "3.5.16", "http-signature": "1.2.0", "inquirer": "5.2.0", "is-root": "2.0.0", "is-url": "1.2.4", "js-yaml": "3.11.0", - "jsdom": "11.10.0", + "jsdom": "11.11.0", "koa": "2.5.1", - "koa-bodyparser": "4.2.0", + "koa-bodyparser": "4.2.1", "koa-compress": "3.0.0", "koa-favicon": "2.0.1", "koa-json-body": "5.3.0", @@ -163,18 +163,18 @@ "object-assign-deep": "0.4.0", "on-build-webpack": "0.1.0", "os-utils": "0.0.14", - "parse5": "4.0.0", + "parse5": "5.0.0", "progress-bar-webpack-plugin": "1.11.0", "prominence": "0.2.0", "promise-sequential": "1.1.1", "pug": "2.0.3", - "punycode": "2.1.0", + "punycode": "2.1.1", "qrcode": "1.2.0", "ratelimiter": "3.0.3", "recaptcha-promise": "0.1.3", "reconnecting-websocket": "3.2.2", "redis": "2.8.0", - "request": "2.86.0", + "request": "2.87.0", "request-promise-native": "1.0.5", "rimraf": "2.6.2", "rndstr": "1.0.0", @@ -193,7 +193,7 @@ "textarea-caret": "3.1.0", "tmp": "0.0.33", "ts-loader": "4.3.0", - "ts-node": "6.0.3", + "ts-node": "6.0.4", "tslint": "5.10.0", "typescript": "2.8.3", "typescript-eslint-parser": "15.0.0", @@ -205,7 +205,7 @@ "vue-cropperjs": "2.2.0", "vue-js-modal": "1.3.13", "vue-json-tree-view": "2.1.4", - "vue-loader": "15.1.0", + "vue-loader": "15.2.1", "vue-material": "^1.0.0-beta-10.2", "vue-router": "3.0.1", "vue-template-compiler": "2.5.16", @@ -214,10 +214,10 @@ "vuex-persistedstate": "^2.5.4", "web-push": "3.3.1", "webfinger.js": "2.6.6", - "webpack": "4.8.3", - "webpack-cli": "2.1.3", + "webpack": "4.9.1", + "webpack-cli": "2.1.4", "websocket": "1.0.26", - "ws": "5.1.1", + "ws": "5.2.0", "xev": "2.0.0" } } From 65a3bac5431c1d11994e9ccff3163f18f5eb2600 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 26 May 2018 13:25:10 +0900 Subject: [PATCH 002/369] :v: --- src/models/user.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/models/user.ts b/src/models/user.ts index 477bb232e..ff1ae57d7 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -169,9 +169,9 @@ export async function deleteUser(user: string | mongo.ObjectID | IUser) { ).map(x => deleteAccessToken(x))); // このユーザーのNoteをすべて削除 - //await sequential(( - // await Note.find({ userId: u._id }) - //).map(x => () => deleteNote(x))); + await sequential(( + await Note.find({ userId: u._id }) + ).map(x => () => deleteNote(x))); // このユーザーのNoteReactionをすべて削除 await Promise.all(( From 5415b67baac04a7d11a8a296b5c6991fc8726003 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 26 May 2018 16:04:47 +0900 Subject: [PATCH 003/369] Fix bug --- package.json | 2 +- src/models/app.ts | 2 +- src/models/auth-session.ts | 2 +- src/models/drive-file.ts | 2 +- src/models/drive-folder.ts | 2 +- src/models/favorite.ts | 2 +- src/models/messaging-message.ts | 2 +- src/models/note-reaction.ts | 2 +- src/models/note.ts | 2 +- src/models/notification.ts | 2 +- src/models/othello-game.ts | 2 +- src/models/othello-matching.ts | 2 +- src/models/signin.ts | 2 +- src/models/user-list.ts | 2 +- src/models/user.ts | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index e67b33ceb..3806074de 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "css-loader": "0.28.11", "debug": "3.1.0", "deep-equal": "1.0.1", - "deepcopy": "1.0.0", + "deepcopy": "0.6.3", "diskusage": "0.2.4", "dompurify": "1.0.4", "elasticsearch": "15.0.0", diff --git a/src/models/app.ts b/src/models/app.ts index 45c95d92d..7926f2fac 100644 --- a/src/models/app.ts +++ b/src/models/app.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import AccessToken from './access-token'; import db from '../db/mongodb'; import config from '../config'; diff --git a/src/models/auth-session.ts b/src/models/auth-session.ts index 6fe3468a7..219b1a4c8 100644 --- a/src/models/auth-session.ts +++ b/src/models/auth-session.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import db from '../db/mongodb'; import { pack as packApp } from './app'; diff --git a/src/models/drive-file.ts b/src/models/drive-file.ts index a3a567038..bb98c11a9 100644 --- a/src/models/drive-file.ts +++ b/src/models/drive-file.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import { pack as packFolder } from './drive-folder'; import config from '../config'; import monkDb, { nativeDbConn } from '../db/mongodb'; diff --git a/src/models/drive-folder.ts b/src/models/drive-folder.ts index e7961936a..cafb9cdf1 100644 --- a/src/models/drive-folder.ts +++ b/src/models/drive-folder.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import db from '../db/mongodb'; import DriveFile from './drive-file'; diff --git a/src/models/favorite.ts b/src/models/favorite.ts index d24833f19..45417212e 100644 --- a/src/models/favorite.ts +++ b/src/models/favorite.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import db from '../db/mongodb'; import { pack as packNote } from './note'; diff --git a/src/models/messaging-message.ts b/src/models/messaging-message.ts index a6a50fc8c..ad2d1657e 100644 --- a/src/models/messaging-message.ts +++ b/src/models/messaging-message.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import { pack as packUser } from './user'; import { pack as packFile } from './drive-file'; import db from '../db/mongodb'; diff --git a/src/models/note-reaction.ts b/src/models/note-reaction.ts index 706ae54c1..e5e108c01 100644 --- a/src/models/note-reaction.ts +++ b/src/models/note-reaction.ts @@ -1,6 +1,6 @@ import * as mongo from 'mongodb'; import $ from 'cafy'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import db from '../db/mongodb'; import Reaction from './note-reaction'; import { pack as packUser } from './user'; diff --git a/src/models/note.ts b/src/models/note.ts index 1274901d4..5d7bab383 100644 --- a/src/models/note.ts +++ b/src/models/note.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import rap from '@prezzemolo/rap'; import db from '../db/mongodb'; import { IUser, pack as packUser } from './user'; diff --git a/src/models/notification.ts b/src/models/notification.ts index 76871166a..c4cf1e4ef 100644 --- a/src/models/notification.ts +++ b/src/models/notification.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import db from '../db/mongodb'; import { IUser, pack as packUser } from './user'; import { pack as packNote } from './note'; diff --git a/src/models/othello-game.ts b/src/models/othello-game.ts index 297aee302..1dd375d2e 100644 --- a/src/models/othello-game.ts +++ b/src/models/othello-game.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import db from '../db/mongodb'; import { IUser, pack as packUser } from './user'; diff --git a/src/models/othello-matching.ts b/src/models/othello-matching.ts index 8082c258c..0efba3ae5 100644 --- a/src/models/othello-matching.ts +++ b/src/models/othello-matching.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import db from '../db/mongodb'; import { IUser, pack as packUser } from './user'; diff --git a/src/models/signin.ts b/src/models/signin.ts index 7f56e1a28..d8b05c0e3 100644 --- a/src/models/signin.ts +++ b/src/models/signin.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import db from '../db/mongodb'; const Signin = db.get('signin'); diff --git a/src/models/user-list.ts b/src/models/user-list.ts index 7100fced7..4cf1de61a 100644 --- a/src/models/user-list.ts +++ b/src/models/user-list.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import db from '../db/mongodb'; const UserList = db.get('userList'); diff --git a/src/models/user.ts b/src/models/user.ts index ff1ae57d7..74ddcc77f 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -1,5 +1,5 @@ import * as mongo from 'mongodb'; -import deepcopy = require('deepcopy'); +import * as deepcopy from 'deepcopy'; import sequential = require('promise-sequential'); import rap from '@prezzemolo/rap'; import db from '../db/mongodb'; From ddb413ca52e9c3a2b182c929007efd80727f81cf Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 26 May 2018 16:05:02 +0900 Subject: [PATCH 004/369] :art: --- src/client/app/mobile/views/components/note-preview.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/app/mobile/views/components/note-preview.vue b/src/client/app/mobile/views/components/note-preview.vue index 8fa57768e..f3805ac48 100644 --- a/src/client/app/mobile/views/components/note-preview.vue +++ b/src/client/app/mobile/views/components/note-preview.vue @@ -61,7 +61,7 @@ root(isDark) > header display flex align-items baseline - margin-bottom 4px + margin-bottom 2px white-space nowrap > .avatar From 8f175186bcd62d2a4372eef8147119ed2ccb0f66 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 26 May 2018 16:08:57 +0900 Subject: [PATCH 005/369] Fix bug --- src/client/app/mobile/views/pages/notifications.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/app/mobile/views/pages/notifications.vue b/src/client/app/mobile/views/pages/notifications.vue index 2e98201ca..64cfa60da 100644 --- a/src/client/app/mobile/views/pages/notifications.vue +++ b/src/client/app/mobile/views/pages/notifications.vue @@ -24,7 +24,7 @@ export default Vue.extend({ const ok = window.confirm('%i18n:@read-all%'); if (!ok) return; - (this as any).api('notifications/markAsRead_all'); + (this as any).api('notifications/mark_as_read_all'); }, onFetched() { Progress.done(); From f840d491e56b55101491b494a91ee47e0396d395 Mon Sep 17 00:00:00 2001 From: Zero King Date: Sat, 26 May 2018 11:43:09 +0000 Subject: [PATCH 006/369] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a44c7e16e..842c3e8a3 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ ultimately sophisticated new type of mini-blog based SNS. * Real time contents * ActivityPub compatible -and more! You can touch with your own eyes at [misskey.xyz](https://misskey.xyz). +and more! You can see it with your own eyes at [misskey.xyz](https://misskey.xyz). :package: Create your instance ---------------------------------------------------------------- From 67b3461c242e50a3248f99bb164d160db2823db1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 26 May 2018 23:20:52 +0900 Subject: [PATCH 007/369] Better mention handling --- .../app/desktop/views/components/post-form.vue | 12 ++++++++++++ src/client/app/mobile/views/components/post-form.vue | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue index 0696d4e82..0e0848524 100644 --- a/src/client/app/desktop/views/components/post-form.vue +++ b/src/client/app/desktop/views/components/post-form.vue @@ -49,6 +49,7 @@ import Vue from 'vue'; import * as XDraggable from 'vuedraggable'; import getKao from '../../../common/scripts/get-kao'; import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue'; +import parse from '../../../../../text/parse'; export default Vue.extend({ components: { @@ -110,6 +111,17 @@ export default Vue.extend({ this.text = `@${this.reply.user.username}@${this.reply.user.host} `; } + if (this.reply && this.reply.text != null) { + const ast = parse(this.reply.text); + + ast.filter(t => t.type == 'mention').forEach(x => { + const mention = x.host ? `@${x.username}@${x.host}` : `@${x.username}`; + if (this.text.indexOf(`${mention} `) == -1) { + this.text += `${mention} `; + } + }); + } + this.$nextTick(() => { // 書きかけの投稿を復元 const draft = JSON.parse(localStorage.getItem('drafts') || '{}')[this.draftId]; diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue index b3b5ffd50..55347b7e5 100644 --- a/src/client/app/mobile/views/components/post-form.vue +++ b/src/client/app/mobile/views/components/post-form.vue @@ -49,6 +49,7 @@ import Vue from 'vue'; import * as XDraggable from 'vuedraggable'; import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue'; import getKao from '../../../common/scripts/get-kao'; +import parse from '../../../../../text/parse'; export default Vue.extend({ components: { @@ -78,6 +79,17 @@ export default Vue.extend({ this.text = `@${this.reply.user.username}@${this.reply.user.host} `; } + if (this.reply && this.reply.text != null) { + const ast = parse(this.reply.text); + + ast.filter(t => t.type == 'mention').forEach(x => { + const mention = x.host ? `@${x.username}@${x.host}` : `@${x.username}`; + if (this.text.indexOf(`${mention} `) == -1) { + this.text += `${mention} `; + } + }); + } + this.$nextTick(() => { this.focus(); }); From 102aaeb3907b06b3a13371474df41cb1160d0084 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 26 May 2018 23:34:20 +0900 Subject: [PATCH 008/369] Darken --- .../app/desktop/views/components/calendar.vue | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/client/app/desktop/views/components/calendar.vue b/src/client/app/desktop/views/components/calendar.vue index 9a93841e5..3b0330cf6 100644 --- a/src/client/app/desktop/views/components/calendar.vue +++ b/src/client/app/desktop/views/components/calendar.vue @@ -138,6 +138,7 @@ root(isDark) background isDark ? #282C37 : #fff border solid 1px rgba(#000, 0.075) border-radius 6px + overflow hidden &[data-melt] background transparent !important @@ -151,9 +152,12 @@ root(isDark) line-height 42px font-size 0.9em font-weight bold - color #888 + color isDark ? #c5ced6 : #888 box-shadow 0 1px rgba(#000, 0.07) + if isDark + background #313543 + > [data-fa] margin-right 4px @@ -165,13 +169,13 @@ root(isDark) width 42px font-size 0.9em line-height 42px - color #ccc + color isDark ? #9baec8 : #ccc &:hover - color #aaa + color isDark ? #b2c1d5 : #aaa &:active - color #999 + color isDark ? #b2c1d5 : #999 &:first-of-type left 0 @@ -194,49 +198,49 @@ root(isDark) font-size 14px &.weekday - color #19a2a9 + color isDark ? #43d5dc : #19a2a9 &[data-is-donichi] - color #ef95a0 + color isDark ? #ff6679 : #ef95a0 &[data-today] - box-shadow 0 0 0 1px #19a2a9 inset + box-shadow 0 0 0 1px isDark ? #43d5dc : #19a2a9 inset border-radius 6px &[data-is-donichi] - box-shadow 0 0 0 1px #ef95a0 inset + box-shadow 0 0 0 1px isDark ? #ff6679 : #ef95a0 inset &.day cursor pointer - color #777 + color isDark ? #c5ced6 : #777 > div border-radius 6px &:hover > div - background rgba(#000, 0.025) + background rgba(#000, isDark ? 0.1 : 0.025) &:active > div - background rgba(#000, 0.05) + background rgba(#000, isDark ? 0.2 : 0.05) &[data-is-donichi] - color #ef95a0 + color isDark ? #ff6679 : #ef95a0 &[data-is-out-of-range] cursor default - color rgba(#777, 0.5) + color rgba(isDark ? #c5ced6 : #777, 0.5) &[data-is-donichi] - color rgba(#ef95a0, 0.5) + color rgba(isDark ? #ff6679 : #ef95a0, 0.5) &[data-selected] font-weight bold > div - background rgba(#000, 0.025) + background rgba(#000, isDark ? 0.1 : 0.025) &:active > div - background rgba(#000, 0.05) + background rgba(#000, isDark ? 0.2 : 0.05) &[data-today] > div From 100557e975a0aab19d0fa42e552ac5bf7882a65f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 26 May 2018 23:37:40 +0900 Subject: [PATCH 009/369] Fix bug --- .../views/components/user-list-timeline.vue | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 59d6abbbc..c0ba995b6 100644 --- a/src/client/app/mobile/views/components/user-list-timeline.vue +++ b/src/client/app/mobile/views/components/user-list-timeline.vue @@ -12,6 +12,7 @@ const fetchLimit = 10; export default Vue.extend({ props: ['list'], + data() { return { fetching: true, @@ -20,15 +21,25 @@ export default Vue.extend({ connection: null }; }, + + computed: { + canFetchMore(): boolean { + return !this.moreFetching && !this.fetching && this.existMore; + } + }, + watch: { $route: 'init' }, + mounted() { this.init(); }, + beforeDestroy() { this.connection.close(); }, + methods: { init() { if (this.connection) this.connection.close(); @@ -39,6 +50,7 @@ export default Vue.extend({ this.fetch(); }, + fetch() { this.fetching = true; @@ -59,7 +71,10 @@ export default Vue.extend({ }, rej); })); }, + more() { + if (!this.canFetchMore) return; + this.moreFetching = true; (this as any).api('notes/user-list-timeline', { @@ -78,13 +93,16 @@ export default Vue.extend({ this.moreFetching = false; }); }, + onNote(note) { // Prepend a note (this.$refs.timeline as any).prepend(note); }, + onUserAdded() { this.fetch(); }, + onUserRemoved() { this.fetch(); } From d29459fa3781043c4e484c876966dbae5c98a538 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 26 May 2018 23:53:22 +0900 Subject: [PATCH 010/369] Fix bug --- .../desktop/views/components/timeline.core.vue | 8 ++++++-- .../views/components/user-list-timeline.vue | 8 ++++++-- .../desktop/views/pages/user/user.timeline.vue | 17 +++++++++++++++-- .../views/components/user-list-timeline.vue | 8 ++++++-- .../mobile/views/components/user-timeline.vue | 9 +++++++-- .../app/mobile/views/pages/home.timeline.vue | 8 ++++++-- 6 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/client/app/desktop/views/components/timeline.core.vue b/src/client/app/desktop/views/components/timeline.core.vue index 254a5b9d6..3c7e87aea 100644 --- a/src/client/app/desktop/views/components/timeline.core.vue +++ b/src/client/app/desktop/views/components/timeline.core.vue @@ -120,12 +120,14 @@ export default Vue.extend({ this.moreFetching = true; - (this as any).api(this.endpoint, { + const promise = (this as any).api(this.endpoint, { limit: fetchLimit + 1, untilId: (this.$refs.timeline as any).tail().id, includeMyRenotes: (this as any).clientSettings.showMyRenotes, includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes - }).then(notes => { + }); + + promise.then(notes => { if (notes.length == fetchLimit + 1) { notes.pop(); } else { @@ -134,6 +136,8 @@ export default Vue.extend({ notes.forEach(n => (this.$refs.timeline as any).append(n)); this.moreFetching = false; }); + + return promise; }, onNote(note) { diff --git a/src/client/app/desktop/views/components/user-list-timeline.vue b/src/client/app/desktop/views/components/user-list-timeline.vue index 59d6abbbc..4f14da70f 100644 --- a/src/client/app/desktop/views/components/user-list-timeline.vue +++ b/src/client/app/desktop/views/components/user-list-timeline.vue @@ -62,13 +62,15 @@ export default Vue.extend({ more() { this.moreFetching = true; - (this as any).api('notes/user-list-timeline', { + const promise = (this as any).api('notes/user-list-timeline', { listId: this.list.id, limit: fetchLimit + 1, untilId: (this.$refs.timeline as any).tail().id, includeMyRenotes: (this as any).clientSettings.showMyRenotes, includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes - }).then(notes => { + }); + + promise.then(notes => { if (notes.length == fetchLimit + 1) { notes.pop(); } else { @@ -77,6 +79,8 @@ export default Vue.extend({ notes.forEach(n => (this.$refs.timeline as any).append(n)); this.moreFetching = false; }); + + return promise; }, onNote(note) { // Prepend a note diff --git a/src/client/app/desktop/views/pages/user/user.timeline.vue b/src/client/app/desktop/views/pages/user/user.timeline.vue index 576a28510..812b5b422 100644 --- a/src/client/app/desktop/views/pages/user/user.timeline.vue +++ b/src/client/app/desktop/views/pages/user/user.timeline.vue @@ -21,6 +21,7 @@ const fetchLimit = 10; export default Vue.extend({ props: ['user'], + data() { return { fetching: true, @@ -31,19 +32,23 @@ export default Vue.extend({ date: null }; }, + watch: { mode() { this.fetch(); } }, + mounted() { document.addEventListener('keydown', this.onDocumentKeydown); this.fetch(() => this.$emit('loaded')); }, + beforeDestroy() { document.removeEventListener('keydown', this.onDocumentKeydown); }, + methods: { onDocumentKeydown(e) { if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA') { @@ -52,6 +57,7 @@ export default Vue.extend({ } } }, + fetch(cb?) { this.fetching = true; (this.$refs.timeline as any).init(() => new Promise((res, rej) => { @@ -72,15 +78,19 @@ export default Vue.extend({ }, rej); })); }, + more() { this.moreFetching = true; - (this as any).api('users/notes', { + + const promise = (this as any).api('users/notes', { userId: this.user.id, limit: fetchLimit + 1, includeReplies: this.mode == 'with-replies', withMedia: this.mode == 'with-media', untilId: (this.$refs.timeline as any).tail().id - }).then(notes => { + }); + + promise.then(notes => { if (notes.length == fetchLimit + 1) { notes.pop(); } else { @@ -89,7 +99,10 @@ export default Vue.extend({ notes.forEach(n => (this.$refs.timeline as any).append(n)); this.moreFetching = false; }); + + return promise; }, + warp(date) { this.date = date; this.fetch(); 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 c0ba995b6..629151302 100644 --- a/src/client/app/mobile/views/components/user-list-timeline.vue +++ b/src/client/app/mobile/views/components/user-list-timeline.vue @@ -77,13 +77,15 @@ export default Vue.extend({ this.moreFetching = true; - (this as any).api('notes/user-list-timeline', { + const promise = (this as any).api('notes/user-list-timeline', { listId: this.list.id, limit: fetchLimit + 1, untilId: (this.$refs.timeline as any).tail().id, includeMyRenotes: (this as any).clientSettings.showMyRenotes, includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes - }).then(notes => { + }); + + promise.then(notes => { if (notes.length == fetchLimit + 1) { notes.pop(); } else { @@ -92,6 +94,8 @@ export default Vue.extend({ notes.forEach(n => (this.$refs.timeline as any).append(n)); this.moreFetching = false; }); + + return promise; }, onNote(note) { diff --git a/src/client/app/mobile/views/components/user-timeline.vue b/src/client/app/mobile/views/components/user-timeline.vue index aca6f783b..6be675c0a 100644 --- a/src/client/app/mobile/views/components/user-timeline.vue +++ b/src/client/app/mobile/views/components/user-timeline.vue @@ -59,12 +59,15 @@ export default Vue.extend({ if (!this.canFetchMore) return; this.moreFetching = true; - (this as any).api('users/notes', { + + const promise = (this as any).api('users/notes', { userId: this.user.id, withMedia: this.withMedia, limit: fetchLimit + 1, untilId: (this.$refs.timeline as any).tail().id - }).then(notes => { + }); + + promise.then(notes => { if (notes.length == fetchLimit + 1) { notes.pop(); } else { @@ -73,6 +76,8 @@ export default Vue.extend({ notes.forEach(n => (this.$refs.timeline as any).append(n)); this.moreFetching = false; }); + + return promise; } } }); diff --git a/src/client/app/mobile/views/pages/home.timeline.vue b/src/client/app/mobile/views/pages/home.timeline.vue index 4c1c344db..9ebce53de 100644 --- a/src/client/app/mobile/views/pages/home.timeline.vue +++ b/src/client/app/mobile/views/pages/home.timeline.vue @@ -111,12 +111,14 @@ export default Vue.extend({ this.moreFetching = true; - (this as any).api(this.endpoint, { + const promise = (this as any).api(this.endpoint, { limit: fetchLimit + 1, untilId: (this.$refs.timeline as any).tail().id, includeMyRenotes: (this as any).clientSettings.showMyRenotes, includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes - }).then(notes => { + }); + + promise.then(notes => { if (notes.length == fetchLimit + 1) { notes.pop(); } else { @@ -125,6 +127,8 @@ export default Vue.extend({ notes.forEach(n => (this.$refs.timeline as any).append(n)); this.moreFetching = false; }); + + return promise; }, onNote(note) { From 83c819a1309c42599f0c4acdbc61942484dc54bd Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 27 May 2018 00:18:44 +0900 Subject: [PATCH 011/369] #1539 --- .../app/desktop/views/components/timeline.vue | 23 +++++++++++- src/client/app/mobile/views/pages/home.vue | 37 ++++++++++++++----- src/client/app/store.ts | 7 ++++ 3 files changed, 57 insertions(+), 10 deletions(-) diff --git a/src/client/app/desktop/views/components/timeline.vue b/src/client/app/desktop/views/components/timeline.vue index a776e40a2..6a243ca56 100644 --- a/src/client/app/desktop/views/components/timeline.vue +++ b/src/client/app/desktop/views/components/timeline.vue @@ -31,8 +31,29 @@ export default Vue.extend({ }; }, + watch: { + src() { + this.$store.commit('device/setTl', { + src: this.src, + arg: this.list + }); + }, + + list() { + this.$store.commit('device/setTl', { + src: this.src, + arg: this.list + }); + } + }, + created() { - if ((this as any).os.i.followingCount == 0) { + if (this.$store.state.device.tl) { + this.src = this.$store.state.device.tl.src; + if (this.src == 'list') { + this.list = this.$store.state.device.tl.arg; + } + } else if ((this as any).os.i.followingCount == 0) { this.src = 'local'; } }, diff --git a/src/client/app/mobile/views/pages/home.vue b/src/client/app/mobile/views/pages/home.vue index 5701ff03d..8d10d96c8 100644 --- a/src/client/app/mobile/views/pages/home.vue +++ b/src/client/app/mobile/views/pages/home.vue @@ -5,7 +5,7 @@ %fa:home%%i18n:@home% %fa:R comments%%i18n:@local% %fa:globe%%i18n:@global% - %fa:list%{{ list.title }} + %fa:list%{{ list.title }} @@ -26,17 +26,17 @@ %fa:R comments% %i18n:@local% %fa:globe% %i18n:@global%
- + - +
@@ -64,6 +64,20 @@ export default Vue.extend({ watch: { src() { this.showNav = false; + + this.$store.commit('device/setTl', { + src: this.src, + arg: this.list + }); + }, + + list() { + this.showNav = false; + + this.$store.commit('device/setTl', { + src: this.src, + arg: this.list + }); }, showNav(v) { @@ -76,7 +90,12 @@ export default Vue.extend({ }, created() { - if ((this as any).os.i.followingCount == 0) { + if (this.$store.state.device.tl) { + this.src = this.$store.state.device.tl.src; + if (this.src == 'list') { + this.list = this.$store.state.device.tl.arg; + } + } else if ((this as any).os.i.followingCount == 0) { this.src = 'local'; } }, @@ -85,6 +104,10 @@ export default Vue.extend({ document.title = 'Misskey'; Progress.start(); + + (this.$refs.tl as any).$once('loaded', () => { + Progress.done(); + }); }, methods: { @@ -92,10 +115,6 @@ export default Vue.extend({ (this as any).apis.post(); }, - onLoaded() { - Progress.done(); - }, - warp() { } diff --git a/src/client/app/store.ts b/src/client/app/store.ts index e300d31d8..e787b4146 100644 --- a/src/client/app/store.ts +++ b/src/client/app/store.ts @@ -68,6 +68,13 @@ export default (os: MiOS) => new Vuex.Store({ mutations: { set(state, x: { key: string; value: any }) { state[x.key] = x.value; + }, + + setTl(state, x) { + state.tl = { + src: x.src, + arg: x.arg + }; } } }, From e7d1b6ec00e75c29c89bf5cf555b5b50812ee7e6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 27 May 2018 00:27:46 +0900 Subject: [PATCH 012/369] Fix bug --- .../views/components/timeline.core.vue | 15 --------- src/client/app/desktop/views/pages/home.vue | 33 ------------------- 2 files changed, 48 deletions(-) diff --git a/src/client/app/desktop/views/components/timeline.core.vue b/src/client/app/desktop/views/components/timeline.core.vue index 3c7e87aea..3fcec86e4 100644 --- a/src/client/app/desktop/views/components/timeline.core.vue +++ b/src/client/app/desktop/views/components/timeline.core.vue @@ -34,7 +34,6 @@ export default Vue.extend({ existMore: false, connection: null, connectionId: null, - unreadCount: 0, date: null }; }, @@ -76,7 +75,6 @@ export default Vue.extend({ } document.addEventListener('keydown', this.onKeydown); - document.addEventListener('visibilitychange', this.onVisibilitychange, false); this.fetch(); }, @@ -90,7 +88,6 @@ export default Vue.extend({ this.stream.dispose(this.connectionId); document.removeEventListener('keydown', this.onKeydown); - document.removeEventListener('visibilitychange', this.onVisibilitychange); }, methods: { @@ -141,11 +138,6 @@ export default Vue.extend({ }, onNote(note) { - if (document.hidden && note.userId !== (this as any).os.i.id) { - this.unreadCount++; - document.title = `(${this.unreadCount}) ${getNoteSummary(note)}`; - } - // Prepend a note (this.$refs.timeline as any).prepend(note); }, @@ -163,13 +155,6 @@ export default Vue.extend({ this.fetch(); }, - onVisibilitychange() { - if (!document.hidden) { - this.unreadCount = 0; - document.title = 'Misskey'; - } - }, - onKeydown(e) { if (e.target.tagName != 'INPUT' && e.target.tagName != 'TEXTAREA') { if (e.which == 84) { // t diff --git a/src/client/app/desktop/views/pages/home.vue b/src/client/app/desktop/views/pages/home.vue index e4caa2022..60b257edb 100644 --- a/src/client/app/desktop/views/pages/home.vue +++ b/src/client/app/desktop/views/pages/home.vue @@ -7,7 +7,6 @@ + + diff --git a/src/client/app/desktop/views/components/home.vue b/src/client/app/desktop/views/components/home.vue index 9d34575e5..f51fed745 100644 --- a/src/client/app/desktop/views/components/home.vue +++ b/src/client/app/desktop/views/components/home.vue @@ -6,25 +6,26 @@

%i18n:@add-widget%

diff --git a/src/client/app/mobile/views/pages/widgets.vue b/src/client/app/mobile/views/pages/widgets.vue index 03abcabe8..9d047fa63 100644 --- a/src/client/app/mobile/views/pages/widgets.vue +++ b/src/client/app/mobile/views/pages/widgets.vue @@ -8,17 +8,18 @@