Merge branch 'pari-dev' into pari

This commit is contained in:
fly_mc 2024-11-21 00:22:19 +08:00
commit 2e95c4082b
4 changed files with 61 additions and 31 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "misskey", "name": "misskey",
"version": "2024.11.0-pari.26", "version": "2024.11.0-pari.27",
"codename": "nasubi", "codename": "nasubi",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -68,13 +68,6 @@ export class NoteDeleteService {
await this.notesRepository.decrement({ id: note.replyId }, 'repliesCount', 1); await this.notesRepository.decrement({ id: note.replyId }, 'repliesCount', 1);
} }
if (note.renoteId && note.text == null && !note.hasPoll && (note.fileIds == null || note.fileIds.length === 0)) {
await this.notesRepository.findOneBy({ id: note.renoteId }).then(async (renote) => {
if (!renote) return;
if (renote.userId !== user.id) await this.notesRepository.decrement({ id: renote.id }, 'renoteCount', 1);
});
}
if (!quiet) { if (!quiet) {
this.globalEventService.publishNoteStream(note.id, 'deleted', { this.globalEventService.publishNoteStream(note.id, 'deleted', {
deletedAt: deletedAt, deletedAt: deletedAt,
@ -113,25 +106,15 @@ export class NoteDeleteService {
this.perUserNotesChart.update(user, note, false); this.perUserNotesChart.update(user, note, false);
} }
if (note.renoteId && note.text) { if (this.meta.enableStatsForFederatedInstances) {
// Decrement notes count (user) if (this.userEntityService.isRemoteUser(user)) {
this.decNotesCountOfUser(user); this.federatedInstanceService.fetchOrRegister(user.host).then(async i => {
} else if (!note.renoteId) {
// Decrement notes count (user)
this.decNotesCountOfUser(user);
}
if (this.userEntityService.isRemoteUser(user)) {
this.federatedInstanceService.fetch(user.host).then(async i => {
if (note.renoteId && note.text) {
this.instancesRepository.decrement({ id: i.id }, 'notesCount', 1); this.instancesRepository.decrement({ id: i.id }, 'notesCount', 1);
} else if (!note.renoteId) { if (this.meta.enableChartsForFederatedInstances) {
this.instancesRepository.decrement({ id: i.id }, 'notesCount', 1); this.instanceChart.updateNote(i.host, note, false);
} }
if (this.meta.enableChartsForFederatedInstances) { });
this.instanceChart.updateNote(i.host, note, false); }
}
});
} }
} }

View file

@ -25,17 +25,18 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject, ref } from 'vue'; import { computed, defineAsyncComponent, inject, ref } from 'vue';
import type { MenuItem } from '@/types/menu.js';
import { getProxiedImageUrl, getStaticImageUrl } from '@/scripts/media-proxy.js'; import { getProxiedImageUrl, getStaticImageUrl } from '@/scripts/media-proxy.js';
import { defaultStore } from '@/store.js'; import { defaultStore } from '@/store.js';
import { customEmojisMap } from '@/custom-emojis.js'; import { customEmojisMap } from '@/custom-emojis.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js'; import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js'; import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
import * as sound from '@/scripts/sound.js'; import * as sound from '@/scripts/sound.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialog.vue'; import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialog.vue';
import type { MenuItem } from '@/types/menu.js'; import { $i } from '@/account.js';
const props = defineProps<{ const props = defineProps<{
name: string; name: string;
@ -126,9 +127,31 @@ function onClick(ev: MouseEvent) {
}, },
}); });
if ($i?.isModerator ?? $i?.isAdmin) {
menuItems.push({
text: i18n.ts.edit,
icon: 'ti ti-pencil',
action: async () => {
await edit(props.name);
},
});
}
os.popupMenu(menuItems, ev.currentTarget ?? ev.target); os.popupMenu(menuItems, ev.currentTarget ?? ev.target);
} }
} }
async function edit(name: string) {
const emoji = await misskeyApi('emoji', {
name: name,
});
const { dispose } = os.popup(defineAsyncComponent(() => import('@/pages/emoji-edit-dialog.vue')), {
emoji: emoji,
}, {
closed: () => dispose(),
});
}
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -15,18 +15,22 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { defineAsyncComponent } from 'vue';
import type { MenuItem } from '@/types/menu.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { misskeyApiGet } from '@/scripts/misskey-api.js'; import { misskeyApiGet } from '@/scripts/misskey-api.js';
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js'; import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialog.vue'; import MkCustomEmojiDetailedDialog from '@/components/MkCustomEmojiDetailedDialog.vue';
import { $i } from '@/account.js';
const props = defineProps<{ const props = defineProps<{
emoji: Misskey.entities.EmojiSimple; emoji: Misskey.entities.EmojiSimple;
}>(); }>();
function menu(ev) { function menu(ev) {
os.popupMenu([{ const menuItems: MenuItem[] = [];
menuItems.push({
type: 'label', type: 'label',
text: ':' + props.emoji.name + ':', text: ':' + props.emoji.name + ':',
}, { }, {
@ -48,8 +52,28 @@ function menu(ev) {
closed: () => dispose(), closed: () => dispose(),
}); });
}, },
}], ev.currentTarget ?? ev.target); });
if ($i?.isModerator ?? $i?.isAdmin) {
menuItems.push({
text: i18n.ts.edit,
icon: 'ti ti-pencil',
action: () => {
edit(props.emoji);
},
});
}
os.popupMenu(menuItems, ev.currentTarget ?? ev.target);
} }
const edit = async (emoji) => {
const { dispose } = os.popup(defineAsyncComponent(() => import('@/pages/emoji-edit-dialog.vue')), {
emoji: emoji,
}, {
closed: () => dispose(),
});
};
</script> </script>
<style lang="scss" module> <style lang="scss" module>