From bc627fc55c8cba0d9410d1d54c6ccbc9fe822624 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?=
 <root@acid-chicken.com>
Date: Fri, 20 Jul 2018 19:23:10 +0900
Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=82=B0=E3=82=B5=E3=82=B8=E3=82=A7?=
 =?UTF-8?q?=E3=82=B9=E3=83=88=E3=81=8C=E9=87=8D=E8=A4=87=E3=81=97=E3=81=AA?=
 =?UTF-8?q?=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/client/app/desktop/views/components/post-form.vue | 5 ++---
 src/client/app/mobile/views/components/post-form.vue  | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue
index 5efa1eacca..aaec36ed37 100644
--- a/src/client/app/desktop/views/components/post-form.vue
+++ b/src/client/app/desktop/views/components/post-form.vue
@@ -382,9 +382,8 @@ export default Vue.extend({
 
 			if (this.text && this.text != '') {
 				const hashtags = parse(this.text).filter(x => x.type == 'hashtag').map(x => x.hashtag);
-				let history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
-				history = history.filter(x => !hashtags.includes(x));
-				localStorage.setItem('hashtags', JSON.stringify(hashtags.concat(history)));
+				const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
+				localStorage.setItem('hashtags', JSON.stringify(hashtags.concat(history).reduce((a, c) => a.includes(c) ? a : [...a, c], [])));
 			}
 		},
 
diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue
index 05e8b09865..b04a1968dc 100644
--- a/src/client/app/mobile/views/components/post-form.vue
+++ b/src/client/app/mobile/views/components/post-form.vue
@@ -295,9 +295,8 @@ export default Vue.extend({
 
 			if (this.text && this.text != '') {
 				const hashtags = parse(this.text).filter(x => x.type == 'hashtag').map(x => x.hashtag);
-				let history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
-				history = history.filter(x => !hashtags.includes(x));
-				localStorage.setItem('hashtags', JSON.stringify(hashtags.concat(history)));
+				const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
+				localStorage.setItem('hashtags', JSON.stringify(hashtags.concat(history).reduce((a, c) => a.includes(c) ? a : [...a, c], [])));
 			}
 		},