Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
4ster1sk committed Oct 11, 2024
2 parents 20f534c + 12bc671 commit 019309b
Show file tree
Hide file tree
Showing 140 changed files with 343 additions and 342 deletions.
9 changes: 3 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
## 2024.10.1

### General
-

### Client
- メールアドレス不要でCaptchaが有効な場合にアカウント登録完了後自動でのログインに失敗する問題を修正
- Enhance: l10nの更新
- Fix: メールアドレス不要でCaptchaが有効な場合にアカウント登録完了後自動でのログインに失敗する問題を修正

### Server
-

- Fix: `admin/emoji/update`エンドポイントのidのみ指定した時不正なエラーが発生するバグを修正

## 2024.10.0

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "misskey",
"version": "2024.10.1-beta.1",
"version": "2024.10.1-beta.2",
"codename": "nasubi",
"repository": {
"type": "git",
Expand Down
29 changes: 22 additions & 7 deletions packages/backend/src/core/CustomEmojiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,33 @@ export class CustomEmojiService implements OnApplicationShutdown {
}

@bindThis
public async update(id: MiEmoji['id'], data: {
public async update(data: (
{ id: MiEmoji['id'], name?: string; } | { name: string; id?: MiEmoji['id'], }
) & {
driveFile?: MiDriveFile;
name?: string;
category?: string | null;
aliases?: string[];
license?: string | null;
isSensitive?: boolean;
localOnly?: boolean;
roleIdsThatCanBeUsedThisEmojiAsReaction?: MiRole['id'][];
}, moderator?: MiUser): Promise<void> {
const emoji = await this.emojisRepository.findOneByOrFail({ id: id });
const sameNameEmoji = await this.emojisRepository.findOneBy({ name: data.name, host: IsNull() });
if (sameNameEmoji != null && sameNameEmoji.id !== id) throw new Error('name already exists');
}, moderator?: MiUser): Promise<
null
| 'NO_SUCH_EMOJI'
| 'SAME_NAME_EMOJI_EXISTS'
> {
const emoji = data.id
? await this.getEmojiById(data.id)
: await this.getEmojiByName(data.name!);
if (emoji === null) return 'NO_SUCH_EMOJI';
const id = emoji.id;

// IDと絵文字名が両方指定されている場合は絵文字名の変更を行うため重複チェックが必要
const doNameUpdate = data.id && data.name && (data.name !== emoji.name);
if (doNameUpdate) {
const isDuplicate = await this.checkDuplicate(data.name!);
if (isDuplicate) return 'SAME_NAME_EMOJI_EXISTS';
}

await this.emojisRepository.update(emoji.id, {
updatedAt: new Date(),
Expand All @@ -135,7 +149,7 @@ export class CustomEmojiService implements OnApplicationShutdown {

const packed = await this.emojiEntityService.packDetailed(emoji.id);

if (emoji.name === data.name) {
if (!doNameUpdate) {
this.globalEventService.publishBroadcastStream('emojiUpdated', {
emojis: [packed],
});
Expand All @@ -157,6 +171,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
after: updated,
});
}
return null;
}

@bindThis
Expand Down
33 changes: 15 additions & 18 deletions packages/backend/src/server/api/endpoints/admin/emoji/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
import type { DriveFilesRepository } from '@/models/_.js';
import type { DriveFilesRepository, MiEmoji } from '@/models/_.js';
import { DI } from '@/di-symbols.js';
import { ApiError } from '../../../error.js';

Expand Down Expand Up @@ -78,32 +78,29 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (driveFile == null) throw new ApiError(meta.errors.noSuchFile);
}

let emojiId;
if (ps.id) {
emojiId = ps.id;
const emoji = await this.customEmojiService.getEmojiById(ps.id);
if (!emoji) throw new ApiError(meta.errors.noSuchEmoji);
if (ps.name && (ps.name !== emoji.name)) {
const isDuplicate = await this.customEmojiService.checkDuplicate(ps.name);
if (isDuplicate) throw new ApiError(meta.errors.sameNameEmojiExists);
}
} else {
if (!ps.name) throw new Error('Invalid Params unexpectedly passed. This is a BUG. Please report it to the development team.');
const emoji = await this.customEmojiService.getEmojiByName(ps.name);
if (!emoji) throw new ApiError(meta.errors.noSuchEmoji);
emojiId = emoji.id;
}
// JSON schemeのanyOfの型変換がうまくいっていないらしい
const required = { id: ps.id, name: ps.name } as
| { id: MiEmoji['id']; name?: string }
| { id?: MiEmoji['id']; name: string };

await this.customEmojiService.update(emojiId, {
const error = await this.customEmojiService.update({
...required,
driveFile,
name: ps.name,
category: ps.category,
aliases: ps.aliases,
license: ps.license,
isSensitive: ps.isSensitive,
localOnly: ps.localOnly,
roleIdsThatCanBeUsedThisEmojiAsReaction: ps.roleIdsThatCanBeUsedThisEmojiAsReaction,
}, me);

switch (error) {
case null: return;
case 'NO_SUCH_EMOJI': throw new ApiError(meta.errors.noSuchEmoji);
case 'SAME_NAME_EMOJI_EXISTS': throw new ApiError(meta.errors.sameNameEmojiExists);
}
// 網羅性チェック
const mustBeNever: never = error;
});
}
}
4 changes: 2 additions & 2 deletions packages/frontend-embed/src/components/EmMediaBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ defineProps<{
display: flex;
align-items: center;
width: 100%;
padding: var(--margin);
padding: var(--MI-margin);
margin-top: 4px;
border: 1px solid var(--MI_THEME-inputBorder);
border-radius: var(--radius);
border-radius: var(--MI-radius);
background-color: var(--MI_THEME-panel);
transition: background-color .1s, border-color .1s;
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend-embed/src/components/EmMediaVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ defineProps<{
width: 100%;
height: auto;
aspect-ratio: 16 / 9;
padding: var(--margin);
padding: var(--MI-margin);
border: 1px solid var(--MI_THEME-divider);
border-radius: var(--radius);
border-radius: var(--MI-radius);
background-color: #000;
&:hover {
Expand Down
10 changes: 5 additions & 5 deletions packages/frontend-embed/src/components/EmNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const isDeleted = ref(false);
width: calc(100% - 8px);
height: calc(100% - 8px);
border: dashed 2px var(--MI_THEME-focus);
border-radius: var(--radius);
border-radius: var(--MI-radius);
box-sizing: border-box;
}
}
Expand Down Expand Up @@ -356,7 +356,7 @@ const isDeleted = ref(false);
width: 58px;
height: 58px;
position: sticky !important;
top: calc(22px + var(--stickyTop, 0px));
top: calc(22px + var(--MI-stickyTop, 0px));
left: 0;
}
Expand All @@ -377,7 +377,7 @@ const isDeleted = ref(false);
width: 100%;
margin-top: 14px;
position: sticky;
bottom: calc(var(--stickyBottom, 0px) + 14px);
bottom: calc(var(--MI-stickyBottom, 0px) + 14px);
}
.showLessLabel {
Expand Down Expand Up @@ -430,7 +430,7 @@ const isDeleted = ref(false);
.translation {
border: solid 0.5px var(--MI_THEME-divider);
border-radius: var(--radius);
border-radius: var(--MI-radius);
padding: 12px;
margin-top: 8px;
}
Expand Down Expand Up @@ -550,7 +550,7 @@ const isDeleted = ref(false);
margin: 0 10px 0 0;
width: 46px;
height: 46px;
top: calc(14px + var(--stickyTop, 0px));
top: calc(14px + var(--MI-stickyTop, 0px));
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-embed/src/components/EmNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ const collapsed = ref(appearNote.value.cw == null && isLong);
width: 100%;
margin-top: 14px;
position: sticky;
bottom: calc(var(--stickyBottom, 0px) + 14px);
bottom: calc(var(--MI-stickyBottom, 0px) + 14px);
}
.showLessLabel {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-embed/src/components/EmNoteSimple.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const showContent = ref(false);
height: 34px;
border-radius: 8px;
position: sticky !important;
top: calc(16px + var(--stickyTop, 0px));
top: calc(16px + var(--MI-stickyTop, 0px));
left: 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const collapsed = ref(isLong);
width: 100%;
margin-top: 14px;
position: sticky;
bottom: calc(var(--stickyBottom, 0px) + 14px);
bottom: calc(var(--MI-stickyBottom, 0px) + 14px);
}
.showLessLabel {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-embed/src/pages/clip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function top(ev: MouseEvent) {
display: flex;
min-width: 0;
align-items: center;
gap: var(--margin);
gap: var(--MI-margin);
overflow: hidden;
.headerClipIconRoot {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-embed/src/pages/tag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function top(ev: MouseEvent) {
display: flex;
min-width: 0;
align-items: center;
gap: var(--margin);
gap: var(--MI-margin);
overflow: hidden;
.headerClipIconRoot {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-embed/src/pages/user-timeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function top(ev: MouseEvent) {
display: flex;
min-width: 0;
align-items: center;
gap: var(--margin);
gap: var(--MI-margin);
overflow: hidden;
.avatarLink {
Expand Down
22 changes: 11 additions & 11 deletions packages/frontend-embed/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*/

:root {
--radius: 12px;
--marginFull: 14px;
--marginHalf: 10px;
--MI-radius: 12px;
--MI-marginFull: 14px;
--MI-marginHalf: 10px;

--margin: var(--marginFull);
--MI-margin: var(--MI-marginFull);
}

html {
Expand Down Expand Up @@ -218,12 +218,12 @@ rt {

._panel {
background: var(--MI_THEME-panel);
border-radius: var(--radius);
border-radius: var(--MI-radius);
overflow: clip;
}

._margin {
margin: var(--margin) 0;
margin: var(--MI-margin) 0;
}

._gaps_m {
Expand All @@ -241,7 +241,7 @@ rt {
._gaps {
display: flex;
flex-direction: column;
gap: var(--margin);
gap: var(--MI-margin);
}

._buttons {
Expand All @@ -264,7 +264,7 @@ rt {
box-sizing: border-box;
text-align: center;
border: solid 0.5px var(--MI_THEME-divider);
border-radius: var(--radius);
border-radius: var(--MI-radius);

&:active {
border-color: var(--MI_THEME-accent);
Expand All @@ -273,14 +273,14 @@ rt {

._popup {
background: var(--MI_THEME-popup);
border-radius: var(--radius);
border-radius: var(--MI-radius);
contain: content;
}

._acrylic {
background: var(--MI_THEME-acrylicPanel);
-webkit-backdrop-filter: var(--blur, blur(15px));
backdrop-filter: var(--blur, blur(15px));
-webkit-backdrop-filter: var(--MI-blur, blur(15px));
backdrop-filter: var(--MI-blur, blur(15px));
}

._fullinfo {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-embed/src/ui.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ onUnmounted(() => {
height: auto;
&.rounded {
border-radius: var(--radius);
border-radius: var(--MI-radius);
}
&.noBorder {
Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/src/boot/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ export async function common(createVue: () => App<Element>) {
});

watch(defaultStore.reactiveState.useBlurEffectForModal, v => {
document.documentElement.style.setProperty('--modalBgFilter', v ? 'blur(4px)' : 'none');
document.documentElement.style.setProperty('--MI-modalBgFilter', v ? 'blur(4px)' : 'none');
}, { immediate: true });

watch(defaultStore.reactiveState.useBlurEffect, v => {
if (v) {
document.documentElement.style.removeProperty('--blur');
document.documentElement.style.removeProperty('--MI-blur');
} else {
document.documentElement.style.setProperty('--blur', 'none');
document.documentElement.style.setProperty('--MI-blur', 'none');
}
}, { immediate: true });

Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkAccountMoved.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ misskeyApi('users/show', { userId: props.movedTo }).then(u => user.value = u);
font-size: 90%;
background: var(--MI_THEME-infoWarnBg);
color: var(--MI_THEME-error);
border-radius: var(--radius);
border-radius: var(--MI-radius);
}
.link {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkAnnouncementDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ onMounted(() => {
max-width: 480px;
box-sizing: border-box;
background: var(--MI_THEME-panel);
border-radius: var(--radius);
border-radius: var(--MI-radius);
}
.header {
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/components/MkChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -863,8 +863,8 @@ onMounted(() => {
left: 0;
width: 100%;
height: 100%;
-webkit-backdrop-filter: var(--blur, blur(12px));
backdrop-filter: var(--blur, blur(12px));
-webkit-backdrop-filter: var(--MI-blur, blur(12px));
backdrop-filter: var(--MI-blur, blur(12px));
display: flex;
justify-content: center;
align-items: center;
Expand Down
Loading

0 comments on commit 019309b

Please sign in to comment.