summaryrefslogtreecommitdiff
path: root/src/client/app/common/scripts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-06-18 14:43:56 +0900
committerGitHub <noreply@github.com>2018-06-18 14:43:56 +0900
commit5d3943ffa8cb4090c5c111397e266d255cc2212b (patch)
tree46f692fb21005bdc89499ea012c2436e8a2e90c0 /src/client/app/common/scripts
parentNew translations ja.yml (Spanish) (diff)
parentyatta (diff)
downloadmisskey-5d3943ffa8cb4090c5c111397e266d255cc2212b.tar.gz
misskey-5d3943ffa8cb4090c5c111397e266d255cc2212b.tar.bz2
misskey-5d3943ffa8cb4090c5c111397e266d255cc2212b.zip
Merge branch 'master' into l10n_master
Diffstat (limited to 'src/client/app/common/scripts')
-rw-r--r--src/client/app/common/scripts/compose-notification.ts2
-rw-r--r--src/client/app/common/scripts/streaming/home.ts57
-rw-r--r--src/client/app/common/scripts/streaming/notes-stats.ts (renamed from src/client/app/common/scripts/streaming/server.ts)10
-rw-r--r--src/client/app/common/scripts/streaming/reversi-game.ts (renamed from src/client/app/common/scripts/streaming/othello-game.ts)4
-rw-r--r--src/client/app/common/scripts/streaming/reversi.ts (renamed from src/client/app/common/scripts/streaming/othello.ts)8
-rw-r--r--src/client/app/common/scripts/streaming/server-stats.ts30
6 files changed, 77 insertions, 34 deletions
diff --git a/src/client/app/common/scripts/compose-notification.ts b/src/client/app/common/scripts/compose-notification.ts
index c19b1c5ad0..cc28f75998 100644
--- a/src/client/app/common/scripts/compose-notification.ts
+++ b/src/client/app/common/scripts/compose-notification.ts
@@ -55,7 +55,7 @@ export default function(type, data): Notification {
icon: data.user.avatarUrl + '?thumbnail&size=64'
};
- case 'othello_invited':
+ case 'reversi_invited':
return {
title: '対局への招待があります',
body: `${getUserName(data.parent)}さんから`,
diff --git a/src/client/app/common/scripts/streaming/home.ts b/src/client/app/common/scripts/streaming/home.ts
index 44d07e331a..dd18c70d70 100644
--- a/src/client/app/common/scripts/streaming/home.ts
+++ b/src/client/app/common/scripts/streaming/home.ts
@@ -1,5 +1,3 @@
-import * as merge from 'object-assign-deep';
-
import Stream from './stream';
import StreamManager from './stream-manager';
import MiOS from '../../../mios';
@@ -20,14 +18,36 @@ export class HomeStream extends Stream {
}, 1000 * 60);
// 自分の情報が更新されたとき
- this.on('i_updated', i => {
+ this.on('meUpdated', i => {
if (os.debug) {
console.log('I updated:', i);
}
- merge(me, i);
- // キャッシュ更新
- os.bakeMe();
+ os.store.dispatch('mergeMe', i);
+ });
+
+ this.on('read_all_notifications', () => {
+ os.store.dispatch('mergeMe', {
+ hasUnreadNotification: false
+ });
+ });
+
+ this.on('unread_notification', () => {
+ os.store.dispatch('mergeMe', {
+ hasUnreadNotification: true
+ });
+ });
+
+ this.on('read_all_messaging_messages', () => {
+ os.store.dispatch('mergeMe', {
+ hasUnreadMessagingMessage: false
+ });
+ });
+
+ this.on('unread_messaging_message', () => {
+ os.store.dispatch('mergeMe', {
+ hasUnreadMessagingMessage: true
+ });
});
this.on('clientSettingUpdated', x => {
@@ -38,25 +58,18 @@ export class HomeStream extends Stream {
});
this.on('home_updated', x => {
- if (x.home) {
- os.store.commit('settings/setHome', x.home);
- } else {
- os.store.commit('settings/setHomeWidget', {
- id: x.id,
- data: x.data
- });
- }
+ os.store.commit('settings/setHome', x);
});
this.on('mobile_home_updated', x => {
- if (x.home) {
- os.store.commit('settings/setMobileHome', x.home);
- } else {
- os.store.commit('settings/setMobileHomeWidget', {
- id: x.id,
- data: x.data
- });
- }
+ os.store.commit('settings/setMobileHome', x);
+ });
+
+ this.on('widgetUpdated', x => {
+ os.store.commit('settings/setWidget', {
+ id: x.id,
+ data: x.data
+ });
});
// トークンが再生成されたとき
diff --git a/src/client/app/common/scripts/streaming/server.ts b/src/client/app/common/scripts/streaming/notes-stats.ts
index 2ea4239288..9e3e78a709 100644
--- a/src/client/app/common/scripts/streaming/server.ts
+++ b/src/client/app/common/scripts/streaming/notes-stats.ts
@@ -3,15 +3,15 @@ import StreamManager from './stream-manager';
import MiOS from '../../../mios';
/**
- * Server stream connection
+ * Notes stats stream connection
*/
-export class ServerStream extends Stream {
+export class NotesStatsStream extends Stream {
constructor(os: MiOS) {
- super(os, 'server');
+ super(os, 'notes-stats');
}
}
-export class ServerStreamManager extends StreamManager<ServerStream> {
+export class NotesStatsStreamManager extends StreamManager<NotesStatsStream> {
private os: MiOS;
constructor(os: MiOS) {
@@ -22,7 +22,7 @@ export class ServerStreamManager extends StreamManager<ServerStream> {
public getConnection() {
if (this.connection == null) {
- this.connection = new ServerStream(this.os);
+ this.connection = new NotesStatsStream(this.os);
}
return this.connection;
diff --git a/src/client/app/common/scripts/streaming/othello-game.ts b/src/client/app/common/scripts/streaming/reversi-game.ts
index 9e36f647bb..5638b3013f 100644
--- a/src/client/app/common/scripts/streaming/othello-game.ts
+++ b/src/client/app/common/scripts/streaming/reversi-game.ts
@@ -1,9 +1,9 @@
import Stream from './stream';
import MiOS from '../../../mios';
-export class OthelloGameStream extends Stream {
+export class ReversiGameStream extends Stream {
constructor(os: MiOS, me, game) {
- super(os, 'othello-game', {
+ super(os, 'reversi-game', {
i: me ? me.token : null,
game: game.id
});
diff --git a/src/client/app/common/scripts/streaming/othello.ts b/src/client/app/common/scripts/streaming/reversi.ts
index 8f4f217e39..2e4395f0f1 100644
--- a/src/client/app/common/scripts/streaming/othello.ts
+++ b/src/client/app/common/scripts/streaming/reversi.ts
@@ -2,15 +2,15 @@ import StreamManager from './stream-manager';
import Stream from './stream';
import MiOS from '../../../mios';
-export class OthelloStream extends Stream {
+export class ReversiStream extends Stream {
constructor(os: MiOS, me) {
- super(os, 'othello', {
+ super(os, 'reversi', {
i: me.token
});
}
}
-export class OthelloStreamManager extends StreamManager<OthelloStream> {
+export class ReversiStreamManager extends StreamManager<ReversiStream> {
private me;
private os: MiOS;
@@ -23,7 +23,7 @@ export class OthelloStreamManager extends StreamManager<OthelloStream> {
public getConnection() {
if (this.connection == null) {
- this.connection = new OthelloStream(this.os, this.me);
+ this.connection = new ReversiStream(this.os, this.me);
}
return this.connection;
diff --git a/src/client/app/common/scripts/streaming/server-stats.ts b/src/client/app/common/scripts/streaming/server-stats.ts
new file mode 100644
index 0000000000..9983dfcaf0
--- /dev/null
+++ b/src/client/app/common/scripts/streaming/server-stats.ts
@@ -0,0 +1,30 @@
+import Stream from './stream';
+import StreamManager from './stream-manager';
+import MiOS from '../../../mios';
+
+/**
+ * Server stats stream connection
+ */
+export class ServerStatsStream extends Stream {
+ constructor(os: MiOS) {
+ super(os, 'server-stats');
+ }
+}
+
+export class ServerStatsStreamManager extends StreamManager<ServerStatsStream> {
+ private os: MiOS;
+
+ constructor(os: MiOS) {
+ super();
+
+ this.os = os;
+ }
+
+ public getConnection() {
+ if (this.connection == null) {
+ this.connection = new ServerStatsStream(this.os);
+ }
+
+ return this.connection;
+ }
+}