Skip to content

新着ノートをサウンドで通知する機能をdeck UIに追加 #13867

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

Merged
merged 17 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
- Enhance: AiScriptを0.18.0にバージョンアップ
- Enhance: 通常のノートでも、お気に入りに登録したチャンネルにリノートできるように
- Enhance: 長いテキストをペーストした際にテキストファイルとして添付するかどうかを選択できるように
- Enhance: 新着ノートをサウンドで通知する機能をdeck UIに追加しました
- これに伴いアンテナの通知機能が完全に廃止されました
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
- Fix: 周年の実績が閏年を考慮しない問題を修正
- Fix: ローカルURLのプレビューポップアップが左上に表示される
Expand Down
4 changes: 4 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9111,6 +9111,10 @@ export interface Locale extends ILocale {
* カラムを追加
*/
"addColumn": string;
/**
* 新しいノートを通知する
*/
"notifyNotes": 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 @@ -2410,6 +2410,7 @@ _deck:
alwaysShowMainColumn: "常にメインカラムを表示"
columnAlign: "カラムの寄せ"
addColumn: "カラムを追加"
notifyNotes: "新しいノートを通知する"
configureColumn: "カラムの設定"
swapLeft: "左に移動"
swapRight: "右に移動"
Expand Down
1 change: 0 additions & 1 deletion packages/backend/src/core/entities/AntennaEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export class AntennaEntityService {
users: antenna.users,
caseSensitive: antenna.caseSensitive,
localOnly: antenna.localOnly,
notify: antenna.notify,
excludeBots: antenna.excludeBots,
withReplies: antenna.withReplies,
withFile: antenna.withFile,
Expand Down
4 changes: 0 additions & 4 deletions packages/backend/src/models/json-schema/antenna.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ export const packedAntennaSchema = {
optional: false, nullable: false,
default: false,
},
notify: {
type: 'boolean',
optional: false, nullable: false,
},
excludeBots: {
type: 'boolean',
optional: false, nullable: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export class ExportAntennasProcessorService {
excludeBots: antenna.excludeBots,
withReplies: antenna.withReplies,
withFile: antenna.withFile,
notify: antenna.notify,
}));
if (antennas.length - 1 !== index) {
write(', ');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ const validate = new Ajv().compile({
excludeBots: { type: 'boolean' },
withReplies: { type: 'boolean' },
withFile: { type: 'boolean' },
notify: { type: 'boolean' },
},
required: ['name', 'src', 'keywords', 'excludeKeywords', 'users', 'caseSensitive', 'withReplies', 'withFile', 'notify'],
required: ['name', 'src', 'keywords', 'excludeKeywords', 'users', 'caseSensitive', 'withReplies', 'withFile'],
});

@Injectable()
Expand Down Expand Up @@ -92,7 +91,6 @@ export class ImportAntennasProcessorService {
excludeBots: antenna.excludeBots,
withReplies: antenna.withReplies,
withFile: antenna.withFile,
notify: antenna.notify,
}).then(x => this.antennasRepository.findOneByOrFail(x.identifiers[0]));
this.logger.succ('Antenna created: ' + result.id);
this.globalEventService.publishInternalEvent('antennaCreated', result);
Expand Down
4 changes: 1 addition & 3 deletions packages/backend/src/server/api/endpoints/antennas/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ export const paramDef = {
excludeBots: { type: 'boolean' },
withReplies: { type: 'boolean' },
withFile: { type: 'boolean' },
notify: { type: 'boolean' },
},
required: ['name', 'src', 'keywords', 'excludeKeywords', 'users', 'caseSensitive', 'withReplies', 'withFile', 'notify'],
required: ['name', 'src', 'keywords', 'excludeKeywords', 'users', 'caseSensitive', 'withReplies', 'withFile'],
} as const;

@Injectable()
Expand Down Expand Up @@ -128,7 +127,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
excludeBots: ps.excludeBots,
withReplies: ps.withReplies,
withFile: ps.withFile,
notify: ps.notify,
}).then(x => this.antennasRepository.findOneByOrFail(x.identifiers[0]));

this.globalEventService.publishInternalEvent('antennaCreated', antenna);
Expand Down
2 changes: 0 additions & 2 deletions packages/backend/src/server/api/endpoints/antennas/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const paramDef = {
excludeBots: { type: 'boolean' },
withReplies: { type: 'boolean' },
withFile: { type: 'boolean' },
notify: { type: 'boolean' },
},
required: ['antennaId'],
} as const;
Expand Down Expand Up @@ -124,7 +123,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
excludeBots: ps.excludeBots,
withReplies: ps.withReplies,
withFile: ps.withFile,
notify: ps.notify,
isActive: true,
lastUsedAt: new Date(),
});
Expand Down
3 changes: 0 additions & 3 deletions packages/backend/test/e2e/antennas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ describe('アンテナ', () => {
excludeKeywords: [['']],
keywords: [['keyword']],
name: 'test',
notify: false,
src: 'all' as const,
userListId: null,
users: [''],
Expand Down Expand Up @@ -151,7 +150,6 @@ describe('アンテナ', () => {
isActive: true,
keywords: [['keyword']],
name: 'test',
notify: false,
src: 'all',
userListId: null,
users: [''],
Expand Down Expand Up @@ -219,7 +217,6 @@ describe('アンテナ', () => {
{ parameters: () => ({ withReplies: true }) },
{ parameters: () => ({ withFile: false }) },
{ parameters: () => ({ withFile: true }) },
{ parameters: () => ({ notify: false }) },
{ parameters: () => ({ notify: true }) },
];
test.each(antennaParamPattern)('を作成できること($#)', async ({ parameters }) => {
Expand Down
2 changes: 0 additions & 2 deletions packages/backend/test/e2e/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ describe('Account Move', () => {
localOnly: false,
withReplies: false,
withFile: false,
notify: false,
}, alice);
antennaId = antenna.body.id;

Expand Down Expand Up @@ -435,7 +434,6 @@ describe('Account Move', () => {
localOnly: false,
withReplies: false,
withFile: false,
notify: false,
}, alice);

assert.strictEqual(res.status, 403);
Expand Down
3 changes: 0 additions & 3 deletions packages/frontend/src/pages/my-antennas/editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="localOnly">{{ i18n.ts.localOnly }}</MkSwitch>
<MkSwitch v-model="caseSensitive">{{ i18n.ts.caseSensitive }}</MkSwitch>
<MkSwitch v-model="withFile">{{ i18n.ts.withFileAntenna }}</MkSwitch>
<MkSwitch v-model="notify">{{ i18n.ts.notifyAntenna }}</MkSwitch>
</div>
<div :class="$style.actions">
<MkButton inline primary @click="saveAntenna()"><i class="ti ti-device-floppy"></i> {{ i18n.ts.save }}</MkButton>
Expand Down Expand Up @@ -82,7 +81,6 @@ const localOnly = ref<boolean>(props.antenna.localOnly);
const excludeBots = ref<boolean>(props.antenna.excludeBots);
const withReplies = ref<boolean>(props.antenna.withReplies);
const withFile = ref<boolean>(props.antenna.withFile);
const notify = ref<boolean>(props.antenna.notify);
const userLists = ref<Misskey.entities.UserList[] | null>(null);

watch(() => src.value, async () => {
Expand All @@ -99,7 +97,6 @@ async function saveAntenna() {
excludeBots: excludeBots.value,
withReplies: withReplies.value,
withFile: withFile.value,
notify: notify.value,
caseSensitive: caseSensitive.value,
localOnly: localOnly.value,
users: users.value.trim().split('\n').map(x => x.trim()),
Expand Down
18 changes: 15 additions & 3 deletions packages/frontend/src/ui/deck/antenna-column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,38 @@ SPDX-License-Identifier: AGPL-3.0-only
<i class="ti ti-antenna"></i><span style="margin-left: 8px;">{{ column.name }}</span>
</template>

<MkTimeline v-if="column.antennaId" ref="timeline" src="antenna" :antenna="column.antennaId"/>
<MkTimeline v-if="column.antennaId" ref="timeline" src="antenna" :antenna="column.antennaId" :sound="sound"/>
</XColumn>
</template>

<script lang="ts" setup>
import { onMounted, shallowRef } from 'vue';
import { onMounted, ref, shallowRef, watch } from 'vue';
import XColumn from './column.vue';
import { updateColumn, Column } from './deck-store.js';
import MkTimeline from '@/components/MkTimeline.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { MenuItem } from '@/types/menu.js';

const props = defineProps<{
column: Column;
isStacked: boolean;
}>();

const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
const sound = ref(props.column.sound ?? false);

onMounted(() => {
if (props.column.antennaId == null) {
setAntenna();
}
});

watch(sound, v => {
updateColumn(props.column.id, { sound: v });
});

async function setAntenna() {
const antennas = await misskeyApi('antennas/list');
const { canceled, result: antenna } = await os.select({
Expand All @@ -54,7 +60,7 @@ function editAntenna() {
os.pageWindow('my/antennas/' + props.column.antennaId);
}

const menu = [
const menu: MenuItem[] = [
{
icon: 'ti ti-pencil',
text: i18n.ts.selectAntenna,
Expand All @@ -65,6 +71,12 @@ const menu = [
text: i18n.ts.editAntenna,
action: editAntenna,
},
{
type: 'switch',
icon: 'ti ti-bell',
ref: sound,
text: i18n.ts._deck.notifyNotes,
},
];

/*
Expand Down
17 changes: 14 additions & 3 deletions packages/frontend/src/ui/deck/channel-column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ SPDX-License-Identifier: AGPL-3.0-only
<div style="padding: 8px; text-align: center;">
<MkButton primary gradate rounded inline small @click="post"><i class="ti ti-pencil"></i></MkButton>
</div>
<MkTimeline ref="timeline" src="channel" :channel="column.channelId"/>
<MkTimeline ref="timeline" src="channel" :channel="column.channelId" :sound="sound"/>
</template>
</XColumn>
</template>

<script lang="ts" setup>
import { shallowRef } from 'vue';
import { ref, shallowRef, watch } from 'vue';
import * as Misskey from 'misskey-js';
import XColumn from './column.vue';
import { updateColumn, Column } from './deck-store.js';
Expand All @@ -28,6 +28,7 @@ import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { MenuItem } from '@/types/menu.js';

const props = defineProps<{
column: Column;
Expand All @@ -36,11 +37,16 @@ const props = defineProps<{

const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
const channel = shallowRef<Misskey.entities.Channel>();
const sound = ref(props.column.sound ?? false);

if (props.column.channelId == null) {
setChannel();
}

watch(sound, v => {
updateColumn(props.column.id, { sound: v });
});

async function setChannel() {
const channels = await misskeyApi('channels/my-favorites', {
limit: 100,
Expand Down Expand Up @@ -71,9 +77,14 @@ async function post() {
});
}

const menu = [{
const menu: MenuItem[] = [{
icon: 'ti ti-pencil',
text: i18n.ts.selectChannel,
action: setChannel,
}, {
type: 'switch',
icon: 'ti ti-bell',
ref: sound,
text: i18n.ts._deck.notifyNotes,
}];
</script>
1 change: 1 addition & 0 deletions packages/frontend/src/ui/deck/deck-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type Column = {
withRenotes?: boolean;
withReplies?: boolean;
onlyFiles?: boolean;
sound?: boolean;
};

export const deckStore = markRaw(new Storage('deck', {
Expand Down
16 changes: 14 additions & 2 deletions packages/frontend/src/ui/deck/list-column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<i class="ti ti-list"></i><span style="margin-left: 8px;">{{ column.name }}</span>
</template>

<MkTimeline v-if="column.listId" ref="timeline" src="list" :list="column.listId" :withRenotes="withRenotes"/>
<MkTimeline v-if="column.listId" ref="timeline" src="list" :list="column.listId" :withRenotes="withRenotes" :sound="sound"/>
</XColumn>
</template>

Expand All @@ -21,6 +21,7 @@ import MkTimeline from '@/components/MkTimeline.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import { MenuItem } from '@/types/menu.js';

const props = defineProps<{
column: Column;
Expand All @@ -29,6 +30,7 @@ const props = defineProps<{

const timeline = shallowRef<InstanceType<typeof MkTimeline>>();
const withRenotes = ref(props.column.withRenotes ?? true);
const sound = ref(props.column.sound ?? false);

if (props.column.listId == null) {
setList();
Expand All @@ -40,6 +42,10 @@ watch(withRenotes, v => {
});
});

watch(sound, v => {
updateColumn(props.column.id, { sound: v });
});

async function setList() {
const lists = await misskeyApi('users/lists/list');
const { canceled, result: list } = await os.select({
Expand All @@ -59,7 +65,7 @@ function editList() {
os.pageWindow('my/lists/' + props.column.listId);
}

const menu = [
const menu: MenuItem[] = [
{
icon: 'ti ti-pencil',
text: i18n.ts.selectList,
Expand All @@ -75,5 +81,11 @@ const menu = [
text: i18n.ts.showRenotes,
ref: withRenotes,
},
{
type: 'switch',
icon: 'ti ti-bell',
ref: sound,
text: i18n.ts._deck.notifyNotes,
},
];
</script>
Loading
Loading