Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: ハッシュタグのノート一覧ページから、そのハッシュタグで投稿するボタンを追加、お知らせの画像URLを空にできない問題を修正 #10878

Merged
merged 10 commits into from
May 26, 2023
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@
- AiScriptを0.13.3に更新
- Deck UIを使用している場合、`/`以外にアクセスした際にZen UIで表示するように
- メインカラムを設置していない場合の問題を解決
- ハッシュタグのノート一覧ページから、そのハッシュタグで投稿するボタンを追加
- アカウント初期設定ウィザードに戻るボタンを追加
- アカウントの初期設定ウィザードにあとでボタンを追加
- Fix: URLプレビューで情報が取得できなかった際の挙動を修正
- Fix: Safari、Firefoxでの新規登録時、パスワードマネージャーにメールアドレスが登録されていた挙動を修正
- fix:ロールタイムラインが無効でも投稿が流れてしまう問題の修正
- fix:ロールタイムラインにて全ての投稿が流れてしまう問題の修正

### Server
- Fix: お知らせの画像URLを空にできない問題を修正

## 13.12.2

## NOTE
Expand Down
1 change: 1 addition & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,7 @@ export interface Locale {
"noBotProtectionWarning": string;
"configure": string;
"postToGallery": string;
"postToHashtag": string;
"gallery": string;
"recentPosts": string;
"popularPosts": string;
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ noMaintainerInformationWarning: "管理者情報が設定されていません
noBotProtectionWarning: "Botプロテクションが設定されていません。"
configure: "設定する"
postToGallery: "ギャラリーへ投稿"
postToHashtag: "このハッシュタグで投稿"
gallery: "ギャラリー"
recentPosts: "最近の投稿"
popularPosts: "人気の投稿"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const paramDef = {
id: { type: 'string', format: 'misskey:id' },
title: { type: 'string', minLength: 1 },
text: { type: 'string', minLength: 1 },
imageUrl: { type: 'string', nullable: true, minLength: 1 },
imageUrl: { type: 'string', nullable: true, minLength: 0 },
},
required: ['id', 'title', 'text', 'imageUrl'],
} as const;
Expand All @@ -46,7 +46,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
updatedAt: new Date(),
title: ps.title,
text: ps.text,
imageUrl: ps.imageUrl,
/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- 空の文字列の場合、nullを渡すようにするため */
imageUrl: ps.imageUrl || null,
});
});
}
Expand Down
39 changes: 37 additions & 2 deletions packages/frontend/src/pages/tag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@
<MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :contentMax="800">
<MkNotes class="" :pagination="pagination"/>
<MkNotes ref="notes" class="" :pagination="pagination"/>
</MkSpacer>
<template v-if="$i" #footer>
<div :class="$style.footer">
<MkSpacer :contentMax="800" :marginMin="16" :marginMax="16">
<MkButton rounded primary :class="$style.button" @click="post()"><i class="ti ti-pencil"></i>{{ i18n.ts.postToHashtag }}</MkButton>
</MkSpacer>
</div>
</template>
</MkStickyContainer>
</template>

<script lang="ts" setup>
import { computed } from 'vue';
import { computed, ref } from 'vue';
import MkNotes from '@/components/MkNotes.vue';
import MkButton from '@/components/MkButton.vue';
import { definePageMetadata } from '@/scripts/page-metadata';
import { i18n } from '@/i18n';
import { $i } from '@/account';
import { defaultStore } from '@/store';
import * as os from '@/os';

const props = defineProps<{
tag: string;
Expand All @@ -23,6 +35,16 @@ const pagination = {
tag: props.tag,
})),
};
const notes = ref<InstanceType<typeof MkNotes>>();

async function post() {
defaultStore.set('postFormHashtags', props.tag);
defaultStore.set('postFormWithHashtags', true);
await os.post();
defaultStore.set('postFormHashtags', '');
defaultStore.set('postFormWithHashtags', false);
notes.value?.pagingComponent?.reload();
}

const headerActions = $computed(() => []);

Expand All @@ -33,3 +55,16 @@ definePageMetadata(computed(() => ({
icon: 'ti ti-hash',
})));
</script>

<style lang="scss" module>
.footer {
-webkit-backdrop-filter: var(--blur, blur(15px));
backdrop-filter: var(--blur, blur(15px));
border-top: solid 0.5px var(--divider);
display: flex;
}

.button {
margin: 0 auto var(--margin) auto;
}
</style>