mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
add poll edit warning
This commit is contained in:
parent
17a9b08f54
commit
b753b2ea3a
3 changed files with 25 additions and 0 deletions
10
locales/index.d.ts
vendored
10
locales/index.d.ts
vendored
|
@ -12947,6 +12947,16 @@ export interface Locale extends ILocale {
|
|||
* If disabled, then the proxy account will not be used. User lists will only include notes from local or followed users.
|
||||
*/
|
||||
"enableProxyAccountDescription": string;
|
||||
"_confirmPollEdit": {
|
||||
/**
|
||||
* Are you sure you want to edit this poll?
|
||||
*/
|
||||
"title": string;
|
||||
/**
|
||||
* Editing this poll will cause it to lose all previous votes
|
||||
*/
|
||||
"text": string;
|
||||
};
|
||||
}
|
||||
declare const locales: {
|
||||
[lang: string]: Locale;
|
||||
|
|
|
@ -186,6 +186,7 @@ const posted = ref(false);
|
|||
const text = ref(props.initialText ?? '');
|
||||
const files = ref(props.initialFiles ?? []);
|
||||
const poll = ref<PollEditorModelValue | null>(null);
|
||||
const initialPoll = ref<PollEditorModelValue | null>(null);
|
||||
const useCw = ref<boolean>(!!props.initialCw);
|
||||
const showPreview = ref(store.s.showPreview);
|
||||
watch(showPreview, () => store.set('showPreview', showPreview.value));
|
||||
|
@ -978,6 +979,15 @@ async function post(ev?: MouseEvent) {
|
|||
token = storedAccounts.find(x => x.id === postAccount.value?.id)?.token;
|
||||
}
|
||||
|
||||
if (postData.editId && postData.poll !== initialPoll.value) {
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'warning',
|
||||
title: i18n.ts._confirmPollEdit.title,
|
||||
text: i18n.ts._confirmPollEdit.text,
|
||||
});
|
||||
if (canceled) return;
|
||||
}
|
||||
|
||||
posting.value = true;
|
||||
misskeyApi(postData.editId ? 'notes/edit' : (postData.scheduleNote ? 'notes/schedule/create' : 'notes/create'), postData, token).then(() => {
|
||||
if (props.freezeAfterPosted) {
|
||||
|
@ -1201,6 +1211,7 @@ onMounted(() => {
|
|||
expiresAt: init.poll.expiresAt ? (new Date(init.poll.expiresAt)).getTime() : null,
|
||||
expiredAfter: null,
|
||||
};
|
||||
if (props.editId) initialPoll.value = poll.value;
|
||||
}
|
||||
if (init.visibleUserIds) {
|
||||
misskeyApi('users/show', { userIds: init.visibleUserIds }).then(users => {
|
||||
|
|
|
@ -536,3 +536,7 @@ deleted: "Deleted"
|
|||
|
||||
enableProxyAccount: "Enable the proxy account."
|
||||
enableProxyAccountDescription: "If disabled, then the proxy account will not be used. User lists will only include notes from local or followed users."
|
||||
|
||||
_confirmPollEdit:
|
||||
title: Are you sure you want to edit this poll?
|
||||
text: Editing this poll will cause it to lose all previous votes
|
||||
|
|
Loading…
Add table
Reference in a new issue