summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-11-12 03:04:04 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-11-12 03:04:04 +0900
commit10cb2a833273fc84db5ab0525068f93f01472c1e (patch)
tree296a3b03ccdfd9959d6fbd829767b82438356ef1 /src/web
parentv3017 (diff)
downloadmisskey-10cb2a833273fc84db5ab0525068f93f01472c1e.tar.gz
misskey-10cb2a833273fc84db5ab0525068f93f01472c1e.tar.bz2
misskey-10cb2a833273fc84db5ab0525068f93f01472c1e.zip
Optimization
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/desktop/tags/home-widgets/activity.tag7
-rw-r--r--src/web/app/desktop/tags/home-widgets/channel.tag7
-rw-r--r--src/web/app/desktop/tags/home-widgets/server.tag7
-rw-r--r--src/web/app/desktop/tags/home-widgets/slideshow.tag32
4 files changed, 32 insertions, 21 deletions
diff --git a/src/web/app/desktop/tags/home-widgets/activity.tag b/src/web/app/desktop/tags/home-widgets/activity.tag
index 7bdcd334c9..00cf4ea20b 100644
--- a/src/web/app/desktop/tags/home-widgets/activity.tag
+++ b/src/web/app/desktop/tags/home-widgets/activity.tag
@@ -73,10 +73,13 @@
if (this.view == 2) this.view = 0;
// Save view state
- this.I.client_settings.home.filter(w => w.id == this.opts.id)[0].data.view = this.view;
this.api('i/update_home', {
- home: this.I.client_settings.home
+ id: this.opts.id,
+ data: {
+ view: this.view
+ }
}).then(() => {
+ this.I.client_settings.home.find(w => w.id == this.opts.id).data.view = this.view;
this.I.update();
});
};
diff --git a/src/web/app/desktop/tags/home-widgets/channel.tag b/src/web/app/desktop/tags/home-widgets/channel.tag
index 79b57a1e8a..2c2b6e7fe3 100644
--- a/src/web/app/desktop/tags/home-widgets/channel.tag
+++ b/src/web/app/desktop/tags/home-widgets/channel.tag
@@ -83,10 +83,13 @@
this.zap();
// Save state
- this.I.client_settings.home.filter(w => w.id == this.opts.id)[0].data.channel = this.channelId;
this.api('i/update_home', {
- home: this.I.client_settings.home
+ id: this.opts.id,
+ data: {
+ channel: this.channelId
+ }
}).then(() => {
+ this.I.client_settings.home.find(w => w.id == this.opts.id).data.channel = this.channelId;
this.I.update();
});
};
diff --git a/src/web/app/desktop/tags/home-widgets/server.tag b/src/web/app/desktop/tags/home-widgets/server.tag
index 235867c38a..f4e38aea56 100644
--- a/src/web/app/desktop/tags/home-widgets/server.tag
+++ b/src/web/app/desktop/tags/home-widgets/server.tag
@@ -81,10 +81,13 @@
if (this.view == 6) this.view = 0;
// Save view state
- this.I.client_settings.home.filter(w => w.id == this.opts.id)[0].data.view = this.view;
this.api('i/update_home', {
- home: this.I.client_settings.home
+ id: this.opts.id,
+ data: {
+ view: this.view
+ }
}).then(() => {
+ this.I.client_settings.home.find(w => w.id == this.opts.id).data.view = this.view;
this.I.update();
});
};
diff --git a/src/web/app/desktop/tags/home-widgets/slideshow.tag b/src/web/app/desktop/tags/home-widgets/slideshow.tag
index aa1e45fad3..9d2c06a272 100644
--- a/src/web/app/desktop/tags/home-widgets/slideshow.tag
+++ b/src/web/app/desktop/tags/home-widgets/slideshow.tag
@@ -88,14 +88,7 @@
if (this.size == 2) this.size = 0;
this.applySize();
-
- // Save state
- this.I.client_settings.home.filter(w => w.id == this.opts.id)[0].data.size = this.size;
- this.api('i/update_home', {
- home: this.I.client_settings.home
- }).then(() => {
- this.I.update();
- });
+ this.save();
};
this.change = () => {
@@ -147,14 +140,23 @@
i.one('selected', folder => {
this.folder = folder ? folder.id : null;
this.fetch();
+ this.save();
+ });
+ };
- // Save state
- this.I.client_settings.home.filter(w => w.id == this.opts.id)[0].data.folder = this.folder;
- this.api('i/update_home', {
- home: this.I.client_settings.home
- }).then(() => {
- this.I.update();
- });
+ this.save = () => {
+ // Save state
+ this.api('i/update_home', {
+ id: this.opts.id,
+ data: {
+ folder: this.folder,
+ size: this.size
+ }
+ }).then(() => {
+ const w = this.I.client_settings.home.find(w => w.id == this.opts.id);
+ w.data.folder = this.folder;
+ w.data.size = this.size;
+ this.I.update();
});
};
</script>