Skip to content

Commit

Permalink
メディアタイムライン設定の修正 (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
kozakura913 authored Jul 28, 2024
1 parent 608c7a7 commit f4b7e2b
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 30 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG_yojo.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@
-->

## 0.4.0 (unreleased)
Cherrypick 4.9.0

### Release Date

### General
- Remove: 連合過激派によってローカルのみ投稿機能は削除されました

### Client
- Fix: 引用とCWを併用した場合にタイムラインと詳細で表示が異なる不具合を修正
- Fix: 引用とCWを併用した場合にタイムラインと詳細で表示が異なる不具合を修正 [#231](https://github.com/yojo-art/cherrypick/issues/231)
- Feat: サイコロウィジェット
(Cherry-picked from https://github.com/1673beta/cherrypick/pull/73)

- Fix: メディアタイムラインの可視性を変更できない問題を修正 [#54](https://github.com/yojo-art/cherrypick/issues/54)
### Server
-

Expand Down
1 change: 0 additions & 1 deletion packages/frontend/src/components/MkTimeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ function connectChannel() {
} else if (props.src === 'media') {
connection = stream.useChannel('globalTimeline', {
withRenotes: props.withRenotes,
withReplies: props.withReplies,
withFiles: true,
withCats: props.onlyCats,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const defaultStoreSaveKeys: (keyof typeof defaultStore['state'])[] = [
'enableGlobalTimeline',
'enableListTimeline',
'enableAntennaTimeline',
'enableChannelTimeline',
'enableMediaTimeline',
'useEnterToSend',
'postFormVisibilityHotkey',
'showRenoteConfirmPopup',
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/pages/settings/timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="enableLocalTimeline"><i class="ti ti-planet"></i> {{ i18n.ts._timelines.local }}</MkSwitch>
<MkSwitch v-model="enableSocialTimeline"><i class="ti ti-universe"></i> {{ i18n.ts._timelines.social }}</MkSwitch>
<MkSwitch v-model="enableGlobalTimeline"><i class="ti ti-world"></i> {{ i18n.ts._timelines.global }}</MkSwitch>
<MkSwitch v-model="enableMediaTimeline"><i class="ti ti-photo"></i> {{ i18n.ts._timelines.media }}</MkSwitch>
</div>
</FormSection>

Expand Down Expand Up @@ -57,7 +58,7 @@ const enableSocialTimeline = computed(defaultStore.makeGetterSetter('enableSocia
const enableGlobalTimeline = computed(defaultStore.makeGetterSetter('enableGlobalTimeline'));
const enableListTimeline = computed(defaultStore.makeGetterSetter('enableListTimeline'));
const enableAntennaTimeline = computed(defaultStore.makeGetterSetter('enableAntennaTimeline'));
const enableChannelTimeline = computed(defaultStore.makeGetterSetter('enableChannelTimeline'));
const enableMediaTimeline = computed(defaultStore.makeGetterSetter('enableMediaTimeline'));

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

Expand Down
17 changes: 9 additions & 8 deletions packages/frontend/src/pages/timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const rootEl = shallowRef<HTMLElement>();

const queue = ref(0);
const srcWhenNotSignin = ref<'local' | 'global'>(isLocalTimelineAvailable ? 'local' : 'global');
const src = computed<'home' | 'local' | 'media' | 'social' | 'global' | `list:${string}`>({
const src = computed<'home' | 'local' | 'media' | 'social' | 'global' | 'media' | `list:${string}`>({
get: () => ($i ? defaultStore.reactiveState.tl.value.src : srcWhenNotSignin.value),
set: (x) => saveSrc(x),
});
Expand Down Expand Up @@ -257,7 +257,7 @@ async function chooseChannel(ev: MouseEvent): Promise<void> {
os.popupMenu(items, ev.currentTarget ?? ev.target);
}

function saveSrc(newSrc: 'home' | 'local' | 'media' | 'social' | 'global' | `list:${string}`): void {
function saveSrc(newSrc: 'home' | 'local' | 'media' | 'social' | 'global' | 'media' | `list:${string}`): void {
const out = deepMerge({ src: newSrc }, defaultStore.state.tl);

if (newSrc.startsWith('userList:')) {
Expand Down Expand Up @@ -387,7 +387,7 @@ const headerTabs = computed(() => [...(defaultStore.reactiveState.pinnedUserList
title: i18n.ts._timelines.global,
icon: 'ti ti-world',
iconOnly: true,
}] : []), ...(isGlobalTimelineAvailable && defaultStore.state.enableGlobalTimeline ? [{
}] : []), ...(isGlobalTimelineAvailable && defaultStore.state.enableMediaTimeline ? [{
key: 'media',
title: i18n.ts._timelines.media,
icon: 'ti ti-photo',
Expand All @@ -402,11 +402,6 @@ const headerTabs = computed(() => [...(defaultStore.reactiveState.pinnedUserList
title: i18n.ts.antennas,
iconOnly: true,
onClick: chooseAntenna,
}] : []), ...(defaultStore.state.enableChannelTimeline ? [{
icon: 'ti ti-device-tv',
title: i18n.ts.channel,
iconOnly: true,
onClick: chooseChannel,
}] : [])] as Tab[]);

const headerTabsWhenNotLogin = computed(() => [
Expand All @@ -422,6 +417,12 @@ const headerTabsWhenNotLogin = computed(() => [
icon: 'ti ti-world',
iconOnly: true,
}] : []),
...(isGlobalTimelineAvailable ? [{
key: 'media',
title: i18n.ts._timelines.media,
icon: 'ti ti-photo',
iconOnly: true,
}] : []),
] as Tab[]);

definePageMetadata(() => ({
Expand Down
7 changes: 4 additions & 3 deletions packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const defaultStore = markRaw(new Storage('base', {
local: false,
social: false,
global: false,
media: false,
},
},
keepCw: {
Expand Down Expand Up @@ -193,7 +194,7 @@ export const defaultStore = markRaw(new Storage('base', {
tl: {
where: 'deviceAccount',
default: {
src: 'home' as 'home' | 'local' | 'social' | 'global' | `list:${string}`,
src: 'home' as 'home' | 'local' | 'social' | 'global' | 'media' | `list:${string}`,
userList: null as Misskey.entities.UserList | null,
filter: {
withReplies: false,
Expand Down Expand Up @@ -623,9 +624,9 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: true,
},
enableChannelTimeline: {
enableMediaTimeline: {
where: 'device',
default: false,
default: true,
},

// - Settings/Sounds & Vibrations
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/ui/deck/deck-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type Column = {
channelId?: string;
roleId?: string;
excludeTypes?: typeof notificationTypes[number][];
tl?: 'home' | 'local' | 'media' |'social' | 'global';
tl?: 'home' | 'local' | 'social' | 'global' | 'media';
withRenotes?: boolean;
withReplies?: boolean;
onlyFiles?: boolean;
Expand Down
7 changes: 3 additions & 4 deletions packages/frontend/src/ui/deck/tl-column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ onMounted(() => {
} else if ($i) {
disabled.value = (
(!((instance.policies.ltlAvailable) || ($i.policies.ltlAvailable)) && ['local', 'social'].includes(props.column.tl)) ||
(!((instance.policies.gtlAvailable) || ($i.policies.gtlAvailable)) && ['global'].includes(props.column.tl)));
(!((instance.policies.gtlAvailable) || ($i.policies.gtlAvailable)) && ['global', 'media'].includes(props.column.tl)));
}
});

Expand All @@ -111,12 +111,11 @@ async function setType() {
}, {
value: 'local' as const, text: i18n.ts._timelines.local,
}, {
value: 'media' as const, text: i18n.ts._timelines.media,
},
{
value: 'social' as const, text: i18n.ts._timelines.social,
}, {
value: 'global' as const, text: i18n.ts._timelines.global,
}, {
value: 'media' as const, text: i18n.ts._timelines.media,
}],
});
if (canceled) {
Expand Down
19 changes: 10 additions & 9 deletions packages/frontend/src/widgets/WidgetTimeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<i v-else-if="widgetProps.src === 'social'" class="ti ti-universe"></i>
<i v-else-if="widgetProps.src === 'cat'" class="ti ti-cat"></i>
<i v-else-if="widgetProps.src === 'global'" class="ti ti-world"></i>
<i v-else-if="widgetProps.src === 'media'" class="ti ti-photo"></i>
<i v-else-if="widgetProps.src === 'list'" class="ti ti-list"></i>
<i v-else-if="widgetProps.src === 'antenna'" class="ti ti-antenna"></i>
</template>
Expand All @@ -21,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</button>
</template>

<div v-if="(((widgetProps.src === 'local' || widgetProps.src === 'social') && !isLocalTimelineAvailable) || (widgetProps.src === 'global' && !isGlobalTimelineAvailable))" :class="$style.disabled">
<div v-if="(((widgetProps.src === 'local' || widgetProps.src === 'social') && !isLocalTimelineAvailable) || ((widgetProps.src === 'global'||widgetProps.src === 'media') && !isGlobalTimelineAvailable))" :class="$style.disabled">
<p :class="$style.disabledTitle">
<i class="ti ti-minus"></i>
{{ i18n.ts._disabledTimeline.title }}
Expand Down Expand Up @@ -120,23 +121,23 @@ const choose = async (ev) => {
text: i18n.ts._timelines.home,
icon: 'ti ti-home',
action: () => { setSrc('home'); },
}, {
}, isLocalTimelineAvailable ? {
text: i18n.ts._timelines.local,
icon: 'ti ti-planet',
action: () => { setSrc('local'); },
}, {
text: i18n.ts._timelines.media,
icon: 'ti ti-photo',
action: () => { setSrc('media'); },
}, {
} : undefined, isLocalTimelineAvailable ? {
text: i18n.ts._timelines.social,
icon: 'ti ti-universe',
action: () => { setSrc('social'); },
}, {
} : undefined, isGlobalTimelineAvailable ? {
text: i18n.ts._timelines.global,
icon: 'ti ti-world',
action: () => { setSrc('global'); },
}, antennaItems.length > 0 ? { type: 'divider' } : undefined, ...antennaItems, listItems.length > 0 ? { type: 'divider' } : undefined, ...listItems], ev.currentTarget ?? ev.target).then(() => {
} : undefined, isGlobalTimelineAvailable ? {
text: i18n.ts._timelines.media,
icon: 'ti ti-photo',
action: () => { setSrc('media'); },
} : undefined, antennaItems.length > 0 ? { type: 'divider' } : undefined, ...antennaItems, listItems.length > 0 ? { type: 'divider' } : undefined, ...listItems], ev.currentTarget ?? ev.target).then(() => {
menuOpened.value = false;
});
};
Expand Down

0 comments on commit f4b7e2b

Please sign in to comment.