fix(client): 投稿フォームのハッシュタグ保持フィールドが動作しない問題を修正

Fix #8212
This commit is contained in:
syuilo 2022-01-29 02:54:56 +09:00
parent a222e3d054
commit f0e720931b
2 changed files with 5 additions and 4 deletions

View file

@ -17,6 +17,7 @@
- トレンドウィジェットが動作しないのを修正 - トレンドウィジェットが動作しないのを修正
- リアクション設定で絵文字ピッカーが開かないのを修正 - リアクション設定で絵文字ピッカーが開かないのを修正
- DMページでメンションが含まれる問題を修正 - DMページでメンションが含まれる問題を修正
- 投稿フォームのハッシュタグ保持フィールドが動作しない問題を修正
- Add `img-src` and `media-src` directives to `Content-Security-Policy` for - Add `img-src` and `media-src` directives to `Content-Security-Policy` for
files and media proxy files and media proxy

View file

@ -540,8 +540,8 @@ async function post() {
}; };
if (withHashtags && hashtags && hashtags.trim() !== '') { if (withHashtags && hashtags && hashtags.trim() !== '') {
const hashtags = hashtags.trim().split(' ').map(x => x.startsWith('#') ? x : '#' + x).join(' '); const hashtags_ = hashtags.trim().split(' ').map(x => x.startsWith('#') ? x : '#' + x).join(' ');
data.text = data.text ? `${data.text} ${hashtags}` : hashtags; data.text = data.text ? `${data.text} ${hashtags_}` : hashtags_;
} }
// plugin // plugin
@ -565,9 +565,9 @@ async function post() {
deleteDraft(); deleteDraft();
emit('posted'); emit('posted');
if (data.text && data.text != '') { if (data.text && data.text != '') {
const hashtags = mfm.parse(data.text).filter(x => x.type === 'hashtag').map(x => x.props.hashtag); const hashtags_ = mfm.parse(data.text).filter(x => x.type === 'hashtag').map(x => x.props.hashtag);
const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[]; const history = JSON.parse(localStorage.getItem('hashtags') || '[]') as string[];
localStorage.setItem('hashtags', JSON.stringify(unique(hashtags.concat(history)))); localStorage.setItem('hashtags', JSON.stringify(unique(hashtags_.concat(history))));
} }
posting = false; posting = false;
postAccount = null; postAccount = null;