summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAya Morisawa <AyaMorisawa4869@gmail.com>2018-09-12 03:02:14 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2018-09-12 03:02:14 +0900
commit0ed197d4d9d40ca93f492a5ecd20e9c861a7f7d2 (patch)
treec973bc005591eb9e5f762f5e7933cf11bec124ce /src
parentResolve #2691 (diff)
downloadsharkey-0ed197d4d9d40ca93f492a5ecd20e9c861a7f7d2.tar.gz
sharkey-0ed197d4d9d40ca93f492a5ecd20e9c861a7f7d2.tar.bz2
sharkey-0ed197d4d9d40ca93f492a5ecd20e9c861a7f7d2.zip
Use unique (#2695)
Diffstat (limited to 'src')
-rw-r--r--src/client/app/desktop/views/components/post-form.vue4
-rw-r--r--src/client/app/mobile/views/components/post-form.vue2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue
index 483a51b0ae..c371940aa3 100644
--- a/src/client/app/desktop/views/components/post-form.vue
+++ b/src/client/app/desktop/views/components/post-form.vue
@@ -62,7 +62,7 @@ import getFace from '../../../common/scripts/get-face';
import MkVisibilityChooser from '../../../common/views/components/visibility-chooser.vue';
import parse from '../../../../../mfm/parse';
import { host } from '../../../config';
-import { erase } from '../../../../../prelude/array';
+import { erase, unique } from '../../../../../prelude/array';
import { length } from 'stringz';
import parseAcct from '../../../../../misc/acct/parse';
@@ -397,7 +397,7 @@ export default Vue.extend({
if (this.text && this.text != '') {
const hashtags = parse(this.text).filter(x => x.type == 'hashtag').map(x => x.hashtag);
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], [])));
+ localStorage.setItem('hashtags', JSON.stringify(unique(hashtags.concat(history))));
}
},
diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue
index be20b11f14..212451a5bc 100644
--- a/src/client/app/mobile/views/components/post-form.vue
+++ b/src/client/app/mobile/views/components/post-form.vue
@@ -308,7 +308,7 @@ export default Vue.extend({
if (this.text && this.text != '') {
const hashtags = parse(this.text).filter(x => x.type == 'hashtag').map(x => x.hashtag);
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], [])));
+ localStorage.setItem('hashtags', JSON.stringify(unique(hashtags.concat(history))));
}
},