mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-26 15:43:09 +02:00
Compare commits
No commits in common. "ec8a7b28a893cde1cb6afb7ab7a884382b47307c" and "7b7de4cdb35c8eadd31decd851a70f873c384cba" have entirely different histories.
ec8a7b28a8
...
7b7de4cdb3
10 changed files with 298 additions and 119 deletions
|
@ -216,7 +216,6 @@ import MkRippleEffect from '@/components/MkRippleEffect.vue';
|
||||||
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
|
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
|
||||||
import { shouldCollapsed } from '@/scripts/collapsed.js';
|
import { shouldCollapsed } from '@/scripts/collapsed.js';
|
||||||
import { useRouter } from '@/router/supplier.js';
|
import { useRouter } from '@/router/supplier.js';
|
||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
|
@ -408,15 +407,58 @@ if (!props.mock) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Visibility = 'public' | 'home' | 'followers' | 'specified';
|
||||||
|
|
||||||
|
// defaultStore.state.visibilityがstringなためstringも受け付けている
|
||||||
|
function smallerVisibility(a: Visibility | string, b: Visibility | string): Visibility {
|
||||||
|
if (a === 'specified' || b === 'specified') return 'specified';
|
||||||
|
if (a === 'followers' || b === 'followers') return 'followers';
|
||||||
|
if (a === 'home' || b === 'home') return 'home';
|
||||||
|
// if (a === 'public' || b === 'public')
|
||||||
|
return 'public';
|
||||||
|
}
|
||||||
|
|
||||||
function boostVisibility() {
|
function boostVisibility() {
|
||||||
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
||||||
renote(defaultStore.state.visibilityOnBoost);
|
renote(defaultStore.state.visibilityOnBoost);
|
||||||
} else {
|
} else {
|
||||||
os.popupMenu(boostMenuItems(appearNote, renote), renoteButton.value);
|
os.popupMenu([
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-globe-hemisphere-west ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['public'],
|
||||||
|
action: () => {
|
||||||
|
renote('public');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-house ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['home'],
|
||||||
|
action: () => {
|
||||||
|
renote('home');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-lock ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['followers'],
|
||||||
|
action: () => {
|
||||||
|
renote('followers');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-planet ph-bold ph-lg',
|
||||||
|
text: i18n.ts._timelines.local,
|
||||||
|
action: () => {
|
||||||
|
renote('local');
|
||||||
|
},
|
||||||
|
}], renoteButton.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renote(visibility: Visibility, localOnly: boolean = false) {
|
function renote(visibility: Visibility | 'local') {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
|
|
||||||
|
@ -447,10 +489,18 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
|
||||||
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const configuredVisibility = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility;
|
||||||
|
const localOnlySetting = defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly;
|
||||||
|
|
||||||
|
let noteVisibility = visibility === 'local' || visibility === 'specified' ? smallerVisibility(appearNote.value.visibility, configuredVisibility) : smallerVisibility(visibility, configuredVisibility);
|
||||||
|
if (appearNote.value.channel?.isSensitive) {
|
||||||
|
noteVisibility = smallerVisibility(visibility === 'local' || visibility === 'specified' ? appearNote.value.visibility : visibility, 'home');
|
||||||
|
}
|
||||||
|
|
||||||
if (!props.mock) {
|
if (!props.mock) {
|
||||||
misskeyApi('notes/create', {
|
misskeyApi('notes/create', {
|
||||||
localOnly: localOnly,
|
localOnly: visibility === 'local' ? true : localOnlySetting,
|
||||||
visibility: visibility,
|
visibility: noteVisibility,
|
||||||
renoteId: appearNote.value.id,
|
renoteId: appearNote.value.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
|
|
|
@ -257,7 +257,6 @@ import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||||
import MkPagination, { type Paging } from '@/components/MkPagination.vue';
|
import MkPagination, { type Paging } from '@/components/MkPagination.vue';
|
||||||
import MkReactionIcon from '@/components/MkReactionIcon.vue';
|
import MkReactionIcon from '@/components/MkReactionIcon.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
|
@ -430,15 +429,57 @@ useTooltip(quoteButton, async (showing) => {
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
type Visibility = 'public' | 'home' | 'followers' | 'specified';
|
||||||
|
|
||||||
|
function smallerVisibility(a: Visibility | string, b: Visibility | string): Visibility {
|
||||||
|
if (a === 'specified' || b === 'specified') return 'specified';
|
||||||
|
if (a === 'followers' || b === 'followers') return 'followers';
|
||||||
|
if (a === 'home' || b === 'home') return 'home';
|
||||||
|
// if (a === 'public' || b === 'public')
|
||||||
|
return 'public';
|
||||||
|
}
|
||||||
|
|
||||||
function boostVisibility() {
|
function boostVisibility() {
|
||||||
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
||||||
renote(defaultStore.state.visibilityOnBoost);
|
renote(defaultStore.state.visibilityOnBoost);
|
||||||
} else {
|
} else {
|
||||||
os.popupMenu(boostMenuItems(appearNote, renote), renoteButton.value);
|
os.popupMenu([
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-globe-hemisphere-west ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['public'],
|
||||||
|
action: () => {
|
||||||
|
renote('public');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-house ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['home'],
|
||||||
|
action: () => {
|
||||||
|
renote('home');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-lock ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['followers'],
|
||||||
|
action: () => {
|
||||||
|
renote('followers');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-planet ph-bold ph-lg',
|
||||||
|
text: i18n.ts._timelines.local,
|
||||||
|
action: () => {
|
||||||
|
renote('local');
|
||||||
|
},
|
||||||
|
}], renoteButton.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renote(visibility: Visibility, localOnly: boolean = false) {
|
function renote(visibility: Visibility | 'local') {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
|
|
||||||
|
@ -467,9 +508,17 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
|
||||||
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const configuredVisibility = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility;
|
||||||
|
const localOnlySetting = defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly;
|
||||||
|
|
||||||
|
let noteVisibility = visibility === 'local' || visibility === 'specified' ? smallerVisibility(appearNote.value.visibility, configuredVisibility) : smallerVisibility(visibility, configuredVisibility);
|
||||||
|
if (appearNote.value.channel?.isSensitive) {
|
||||||
|
noteVisibility = smallerVisibility(visibility === 'local' || visibility === 'specified' ? appearNote.value.visibility : visibility, 'home');
|
||||||
|
}
|
||||||
|
|
||||||
misskeyApi('notes/create', {
|
misskeyApi('notes/create', {
|
||||||
localOnly: localOnly,
|
localOnly: visibility === 'local' ? true : localOnlySetting,
|
||||||
visibility: visibility,
|
visibility: noteVisibility,
|
||||||
renoteId: appearNote.value.id,
|
renoteId: appearNote.value.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
|
|
|
@ -105,7 +105,6 @@ import { reactionPicker } from '@/scripts/reaction-picker.js';
|
||||||
import { claimAchievement } from '@/scripts/achievements.js';
|
import { claimAchievement } from '@/scripts/achievements.js';
|
||||||
import { getNoteMenu } from '@/scripts/get-note-menu.js';
|
import { getNoteMenu } from '@/scripts/get-note-menu.js';
|
||||||
import { useNoteCapture } from '@/scripts/use-note-capture.js';
|
import { useNoteCapture } from '@/scripts/use-note-capture.js';
|
||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
|
|
||||||
|
|
||||||
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
|
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
|
||||||
|
|
||||||
|
@ -277,11 +276,43 @@ function boostVisibility() {
|
||||||
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
||||||
renote(defaultStore.state.visibilityOnBoost);
|
renote(defaultStore.state.visibilityOnBoost);
|
||||||
} else {
|
} else {
|
||||||
os.popupMenu(boostMenuItems(appearNote, renote), renoteButton.value);
|
os.popupMenu([
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-globe-hemisphere-west ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['public'],
|
||||||
|
action: () => {
|
||||||
|
renote('public');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-house ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['home'],
|
||||||
|
action: () => {
|
||||||
|
renote('home');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-lock ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['followers'],
|
||||||
|
action: () => {
|
||||||
|
renote('followers');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-planet ph-bold ph-lg',
|
||||||
|
text: i18n.ts._timelines.local,
|
||||||
|
action: () => {
|
||||||
|
renote('local');
|
||||||
|
},
|
||||||
|
}], renoteButton.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renote(visibility: Visibility, localOnly: boolean = false) {
|
function renote(visibility: 'public' | 'home' | 'followers' | 'specified' | 'local') {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
|
|
||||||
|
@ -295,8 +326,8 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
misskeyApi('notes/create', {
|
misskeyApi('notes/create', {
|
||||||
renoteId: appearNote.value.id,
|
renoteId: props.note.id,
|
||||||
channelId: appearNote.value.channelId,
|
channelId: props.note.channelId,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
renoted.value = true;
|
renoted.value = true;
|
||||||
|
@ -311,9 +342,9 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
misskeyApi('notes/create', {
|
misskeyApi('notes/create', {
|
||||||
renoteId: appearNote.value.id,
|
renoteId: props.note.id,
|
||||||
localOnly: localOnly,
|
localOnly: visibility === 'local' ? true : false,
|
||||||
visibility: visibility,
|
visibility: visibility === 'local' || visibility === 'specified' ? props.note.visibility : visibility,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
renoted.value = true;
|
renoted.value = true;
|
||||||
|
|
|
@ -265,7 +265,6 @@ async function onSubmit(): Promise<void> {
|
||||||
'hcaptcha-response': hCaptchaResponse.value,
|
'hcaptcha-response': hCaptchaResponse.value,
|
||||||
'm-captcha-response': mCaptchaResponse.value,
|
'm-captcha-response': mCaptchaResponse.value,
|
||||||
'g-recaptcha-response': reCaptchaResponse.value,
|
'g-recaptcha-response': reCaptchaResponse.value,
|
||||||
'turnstile-response': turnstileResponse.value,
|
|
||||||
});
|
});
|
||||||
if (instance.emailRequiredForSignup) {
|
if (instance.emailRequiredForSignup) {
|
||||||
os.alert({
|
os.alert({
|
||||||
|
|
|
@ -217,7 +217,6 @@ import MkRippleEffect from '@/components/MkRippleEffect.vue';
|
||||||
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
|
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
|
||||||
import { shouldCollapsed } from '@/scripts/collapsed.js';
|
import { shouldCollapsed } from '@/scripts/collapsed.js';
|
||||||
import { useRouter } from '@/router/supplier.js';
|
import { useRouter } from '@/router/supplier.js';
|
||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
|
@ -409,15 +408,58 @@ if (!props.mock) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Visibility = 'public' | 'home' | 'followers' | 'specified';
|
||||||
|
|
||||||
|
// defaultStore.state.visibilityがstringなためstringも受け付けている
|
||||||
|
function smallerVisibility(a: Visibility | string, b: Visibility | string): Visibility {
|
||||||
|
if (a === 'specified' || b === 'specified') return 'specified';
|
||||||
|
if (a === 'followers' || b === 'followers') return 'followers';
|
||||||
|
if (a === 'home' || b === 'home') return 'home';
|
||||||
|
// if (a === 'public' || b === 'public')
|
||||||
|
return 'public';
|
||||||
|
}
|
||||||
|
|
||||||
function boostVisibility() {
|
function boostVisibility() {
|
||||||
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
||||||
renote(defaultStore.state.visibilityOnBoost);
|
renote(defaultStore.state.visibilityOnBoost);
|
||||||
} else {
|
} else {
|
||||||
os.popupMenu(boostMenuItems(appearNote, renote), renoteButton.value);
|
os.popupMenu([
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-globe-hemisphere-west ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['public'],
|
||||||
|
action: () => {
|
||||||
|
renote('public');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-house ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['home'],
|
||||||
|
action: () => {
|
||||||
|
renote('home');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-lock ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['followers'],
|
||||||
|
action: () => {
|
||||||
|
renote('followers');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-planet ph-bold ph-lg',
|
||||||
|
text: i18n.ts._timelines.local,
|
||||||
|
action: () => {
|
||||||
|
renote('local');
|
||||||
|
},
|
||||||
|
}], renoteButton.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renote(visibility: Visibility, localOnly: boolean = false) {
|
function renote(visibility: Visibility | 'local') {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
|
|
||||||
|
@ -448,10 +490,18 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
|
||||||
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const configuredVisibility = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility;
|
||||||
|
const localOnlySetting = defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly;
|
||||||
|
|
||||||
|
let noteVisibility = visibility === 'local' || visibility === 'specified' ? smallerVisibility(appearNote.value.visibility, configuredVisibility) : smallerVisibility(visibility, configuredVisibility);
|
||||||
|
if (appearNote.value.channel?.isSensitive) {
|
||||||
|
noteVisibility = smallerVisibility(visibility === 'local' || visibility === 'specified' ? appearNote.value.visibility : visibility, 'home');
|
||||||
|
}
|
||||||
|
|
||||||
if (!props.mock) {
|
if (!props.mock) {
|
||||||
misskeyApi('notes/create', {
|
misskeyApi('notes/create', {
|
||||||
localOnly: localOnly,
|
localOnly: visibility === 'local' ? true : localOnlySetting,
|
||||||
visibility: visibility,
|
visibility: noteVisibility,
|
||||||
renoteId: appearNote.value.id,
|
renoteId: appearNote.value.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
|
|
|
@ -265,7 +265,6 @@ import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||||
import MkPagination, { type Paging } from '@/components/MkPagination.vue';
|
import MkPagination, { type Paging } from '@/components/MkPagination.vue';
|
||||||
import MkReactionIcon from '@/components/MkReactionIcon.vue';
|
import MkReactionIcon from '@/components/MkReactionIcon.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
|
@ -439,15 +438,57 @@ useTooltip(quoteButton, async (showing) => {
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
type Visibility = 'public' | 'home' | 'followers' | 'specified';
|
||||||
|
|
||||||
|
function smallerVisibility(a: Visibility | string, b: Visibility | string): Visibility {
|
||||||
|
if (a === 'specified' || b === 'specified') return 'specified';
|
||||||
|
if (a === 'followers' || b === 'followers') return 'followers';
|
||||||
|
if (a === 'home' || b === 'home') return 'home';
|
||||||
|
// if (a === 'public' || b === 'public')
|
||||||
|
return 'public';
|
||||||
|
}
|
||||||
|
|
||||||
function boostVisibility() {
|
function boostVisibility() {
|
||||||
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
||||||
renote(defaultStore.state.visibilityOnBoost);
|
renote(defaultStore.state.visibilityOnBoost);
|
||||||
} else {
|
} else {
|
||||||
os.popupMenu(boostMenuItems(appearNote, renote), renoteButton.value);
|
os.popupMenu([
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-globe-hemisphere-west ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['public'],
|
||||||
|
action: () => {
|
||||||
|
renote('public');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-house ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['home'],
|
||||||
|
action: () => {
|
||||||
|
renote('home');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-lock ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['followers'],
|
||||||
|
action: () => {
|
||||||
|
renote('followers');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-planet ph-bold ph-lg',
|
||||||
|
text: i18n.ts._timelines.local,
|
||||||
|
action: () => {
|
||||||
|
renote('local');
|
||||||
|
},
|
||||||
|
}], renoteButton.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renote(visibility: Visibility, localOnly: boolean = false) {
|
function renote(visibility: Visibility | 'local') {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
|
|
||||||
|
@ -476,9 +517,17 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
|
||||||
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
os.popup(MkRippleEffect, { x, y }, {}, 'end');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const configuredVisibility = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility;
|
||||||
|
const localOnlySetting = defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly;
|
||||||
|
|
||||||
|
let noteVisibility = visibility === 'local' || visibility === 'specified' ? smallerVisibility(appearNote.value.visibility, configuredVisibility) : smallerVisibility(visibility, configuredVisibility);
|
||||||
|
if (appearNote.value.channel?.isSensitive) {
|
||||||
|
noteVisibility = smallerVisibility(visibility === 'local' || visibility === 'specified' ? appearNote.value.visibility : visibility, 'home');
|
||||||
|
}
|
||||||
|
|
||||||
misskeyApi('notes/create', {
|
misskeyApi('notes/create', {
|
||||||
localOnly: localOnly,
|
localOnly: visibility === 'local' ? true : localOnlySetting,
|
||||||
visibility: visibility,
|
visibility: noteVisibility,
|
||||||
renoteId: appearNote.value.id,
|
renoteId: appearNote.value.id,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
|
|
|
@ -113,7 +113,6 @@ import { reactionPicker } from '@/scripts/reaction-picker.js';
|
||||||
import { claimAchievement } from '@/scripts/achievements.js';
|
import { claimAchievement } from '@/scripts/achievements.js';
|
||||||
import { getNoteMenu } from '@/scripts/get-note-menu.js';
|
import { getNoteMenu } from '@/scripts/get-note-menu.js';
|
||||||
import { useNoteCapture } from '@/scripts/use-note-capture.js';
|
import { useNoteCapture } from '@/scripts/use-note-capture.js';
|
||||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
|
|
||||||
|
|
||||||
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
|
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
|
||||||
const hideLine = computed(() => { return props.detail ? true : false; });
|
const hideLine = computed(() => { return props.detail ? true : false; });
|
||||||
|
@ -291,11 +290,43 @@ function boostVisibility() {
|
||||||
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
if (!defaultStore.state.showVisibilitySelectorOnBoost) {
|
||||||
renote(defaultStore.state.visibilityOnBoost);
|
renote(defaultStore.state.visibilityOnBoost);
|
||||||
} else {
|
} else {
|
||||||
os.popupMenu(boostMenuItems(appearNote, renote), renoteButton.value);
|
os.popupMenu([
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-globe-hemisphere-west ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['public'],
|
||||||
|
action: () => {
|
||||||
|
renote('public');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-house ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['home'],
|
||||||
|
action: () => {
|
||||||
|
renote('home');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-lock ph-bold ph-lg',
|
||||||
|
text: i18n.ts._visibility['followers'],
|
||||||
|
action: () => {
|
||||||
|
renote('followers');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
icon: 'ph-planet ph-bold ph-lg',
|
||||||
|
text: i18n.ts._timelines.local,
|
||||||
|
action: () => {
|
||||||
|
renote('local');
|
||||||
|
},
|
||||||
|
}], renoteButton.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renote(visibility: Visibility, localOnly: boolean = false) {
|
function renote(visibility: 'public' | 'home' | 'followers' | 'specified' | 'local') {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
showMovedDialog();
|
showMovedDialog();
|
||||||
|
|
||||||
|
@ -309,8 +340,8 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
misskeyApi('notes/create', {
|
misskeyApi('notes/create', {
|
||||||
renoteId: appearNote.value.id,
|
renoteId: props.note.id,
|
||||||
channelId: appearNote.value.channelId,
|
channelId: props.note.channelId,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
renoted.value = true;
|
renoted.value = true;
|
||||||
|
@ -325,9 +356,9 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
misskeyApi('notes/create', {
|
misskeyApi('notes/create', {
|
||||||
renoteId: appearNote.value.id,
|
renoteId: props.note.id,
|
||||||
localOnly: localOnly,
|
localOnly: visibility === 'local' ? true : false,
|
||||||
visibility: visibility,
|
visibility: visibility === 'local' || visibility === 'specified' ? props.note.visibility : visibility,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
renoted.value = true;
|
renoted.value = true;
|
||||||
|
|
|
@ -212,6 +212,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<option value="public">{{ i18n.ts._visibility['public'] }}</option>
|
<option value="public">{{ i18n.ts._visibility['public'] }}</option>
|
||||||
<option value="home">{{ i18n.ts._visibility['home'] }}</option>
|
<option value="home">{{ i18n.ts._visibility['home'] }}</option>
|
||||||
<option value="followers">{{ i18n.ts._visibility['followers'] }}</option>
|
<option value="followers">{{ i18n.ts._visibility['followers'] }}</option>
|
||||||
|
<option value="local">{{ i18n.ts._timelines.local }}</option>
|
||||||
</MkSelect>
|
</MkSelect>
|
||||||
</div>
|
</div>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
|
|
@ -1,81 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: dakkar and other misskey contributors
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { ref, Ref } from 'vue';
|
|
||||||
import * as Misskey from 'misskey-js';
|
|
||||||
import { i18n } from '@/i18n.js';
|
|
||||||
import { defaultStore } from '@/store.js';
|
|
||||||
import { MenuItem } from '@/types/menu.js';
|
|
||||||
|
|
||||||
/*
|
|
||||||
this script should eventually contain all Sharkey-specific bits of
|
|
||||||
boosting and quoting that we would otherwise have to replicate in
|
|
||||||
`{M,S}kNote{,Detailed,Sub}.vue`
|
|
||||||
*/
|
|
||||||
|
|
||||||
export type Visibility = 'public' | 'home' | 'followers' | 'specified';
|
|
||||||
|
|
||||||
export function smallerVisibility(a: Visibility | string, b: Visibility | string): Visibility {
|
|
||||||
if (a === 'specified' || b === 'specified') return 'specified';
|
|
||||||
if (a === 'followers' || b === 'followers') return 'followers';
|
|
||||||
if (a === 'home' || b === 'home') return 'home';
|
|
||||||
// if (a === 'public' || b === 'public')
|
|
||||||
return 'public';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function visibilityIsAtLeast(a: Visibility | string, b: Visibility | string): boolean {
|
|
||||||
return smallerVisibility(a, b) === b;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function boostMenuItems(appearNote: Ref<Misskey.entities.Note>, renote: (v: Visibility, l: boolean) => void): MenuItem[] {
|
|
||||||
const localOnly = ref(defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly);
|
|
||||||
const effectiveVisibility = (
|
|
||||||
appearNote.value.channel?.isSensitive
|
|
||||||
? smallerVisibility(appearNote.value.visibility, 'home')
|
|
||||||
: appearNote.value.visibility
|
|
||||||
);
|
|
||||||
|
|
||||||
const menuItems: MenuItem[] = [];
|
|
||||||
if (visibilityIsAtLeast(effectiveVisibility, 'public')) {
|
|
||||||
menuItems.push({
|
|
||||||
type: 'button',
|
|
||||||
icon: 'ph-globe-hemisphere-west ph-bold ph-lg',
|
|
||||||
text: i18n.ts._visibility['public'],
|
|
||||||
action: () => {
|
|
||||||
renote('public', localOnly.value);
|
|
||||||
},
|
|
||||||
} as MenuItem);
|
|
||||||
}
|
|
||||||
if (visibilityIsAtLeast(effectiveVisibility, 'home')) {
|
|
||||||
menuItems.push({
|
|
||||||
type: 'button',
|
|
||||||
icon: 'ph-house ph-bold ph-lg',
|
|
||||||
text: i18n.ts._visibility['home'],
|
|
||||||
action: () => {
|
|
||||||
renote('home', localOnly.value);
|
|
||||||
},
|
|
||||||
} as MenuItem);
|
|
||||||
}
|
|
||||||
if (visibilityIsAtLeast(effectiveVisibility, 'followers')) {
|
|
||||||
menuItems.push({
|
|
||||||
type: 'button',
|
|
||||||
icon: 'ph-lock ph-bold ph-lg',
|
|
||||||
text: i18n.ts._visibility['followers'],
|
|
||||||
action: () => {
|
|
||||||
renote('followers', localOnly.value);
|
|
||||||
},
|
|
||||||
} as MenuItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
...menuItems,
|
|
||||||
{
|
|
||||||
type: 'switch',
|
|
||||||
icon: 'ph-planet ph-bold ph-lg',
|
|
||||||
text: i18n.ts._timelines.local,
|
|
||||||
ref: localOnly,
|
|
||||||
} as MenuItem,
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -159,7 +159,7 @@ export const defaultStore = markRaw(new Storage('base', {
|
||||||
},
|
},
|
||||||
visibilityOnBoost: {
|
visibilityOnBoost: {
|
||||||
where: 'account',
|
where: 'account',
|
||||||
default: 'public' as 'public' | 'home' | 'followers',
|
default: 'public' as 'public' | 'home' | 'followers' | 'local',
|
||||||
},
|
},
|
||||||
|
|
||||||
menu: {
|
menu: {
|
||||||
|
|
Loading…
Reference in a new issue