Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Announcement Image URL cannot be deleted during creation | アナウンスメントを作成ときにWebUIフォームの画像URLを後悔できない #14976

Closed
1 task done
eternal-flame-AD opened this issue Nov 16, 2024 · 0 comments · Fixed by #14990
Labels
🐛Bug Unexpected behavior packages/backend Server side specific issue/PR

Comments

@eternal-flame-AD
Copy link
Contributor

💡 Summary

タイトル通りです

await this.announcementService.update(announcement, {
updatedAt: new Date(),
title: ps.title,
text: ps.text,
/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- 空の文字列の場合、nullを渡すようにするため */
imageUrl: ps.imageUrl || null,
display: ps.display,
icon: ps.icon,
forExistingUsers: ps.forExistingUsers,
silence: ps.silence,
needConfirmationToRead: ps.needConfirmationToRead,
isActive: ps.isActive,
}, me);

const { raw, packed } = await this.announcementService.create({
updatedAt: null,
title: ps.title,
text: ps.text,
imageUrl: ps.imageUrl,
icon: ps.icon,
display: ps.display,
forExistingUsers: ps.forExistingUsers,
silence: ps.silence,
needConfirmationToRead: ps.needConfirmationToRead,
userId: ps.userId,

Proposed fix

https://forge.yumechi.jp/yume/yumechi-no-kuni/commit/13e50cd8d9e1f8e2d91c0ca387206b904c495fe5

diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts
index 2dae1df87d..b8bfda73a4 100644
--- a/packages/backend/src/server/api/endpoints/admin/announcements/create.ts
+++ b/packages/backend/src/server/api/endpoints/admin/announcements/create.ts
@@ -55,7 +55,7 @@ export const paramDef = {
 	properties: {
 		title: { type: 'string', minLength: 1 },
 		text: { type: 'string', minLength: 1 },
-		imageUrl: { type: 'string', nullable: true, minLength: 1 },
+		imageUrl: { type: 'string', nullable: true, minLength: 0 },
 		icon: { type: 'string', enum: ['info', 'warning', 'error', 'success'], default: 'info' },
 		display: { type: 'string', enum: ['normal', 'banner', 'dialog'], default: 'normal' },
 		forExistingUsers: { type: 'boolean', default: false },
@@ -76,7 +76,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
 				updatedAt: null,
 				title: ps.title,
 				text: ps.text,
-				imageUrl: ps.imageUrl,
+				/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- 空の文字列の場合、nullを渡すようにするため */
+				imageUrl: ps.imageUrl || null,
 				icon: ps.icon,
 				display: ps.display,
 				forExistingUsers: ps.forExistingUsers,

🥰 Expected Behavior

  1. See "Steps to Reproduce"
  2. 200 OK

🤬 Actual Behavior

  1. See "Steps to Reproduce"
  2. 400 Bad Request

📝 Steps to Reproduce

  1. https://misskey-hub.net/en/mi-web/?path=/admin/announcements
  2. 追加
  3. title <- "Test"
  4. text <- "Text"
  5. 画像URL <- "AAA"
  6. 画像URL <- Backspace *3
  7. 保存

💻 Frontend Environment

Not a frontend problem

🛰 Backend Environment (for server admin)

* Installation Method or Hosting Service: Docker-compose.yml (https://forge.yumechi.jp/yume/yumechi-no-kuni/src/branch/develop/compose_example.yml)
* Misskey: [2024.11.0-yumechinokuni.4p1](https://forge.yumechi.jp/yume/yumechi-no-kuni/src/tag/2024.11.0-yumechinokuni.4p1) (tracking misskey-dev#develop)
* OS and Architecture: Arch Linux x86_64

Do you want to address this bug yourself?

  • Yes, I will patch the bug myself and send a pull request
@eternal-flame-AD eternal-flame-AD added the ⚠️bug? This might be a bug label Nov 16, 2024
@kakkokari-gtyih kakkokari-gtyih added 🐛Bug Unexpected behavior packages/backend Server side specific issue/PR and removed ⚠️bug? This might be a bug labels Nov 17, 2024
HotoRas added a commit to HotoRas/misskey-neko that referenced this issue Nov 19, 2024
General:
- Fix: 공지사항 작성 시 이미지 URL 입력란을 빈칸으로 변경할 수 없음 (misskey-dev#14976)

Client:
- Enhance: 사이드바를 쉽게 전개 및 접을 수 있도록 (misskey-dev#14981)
- Enhance: 리노트 메뉴에 '리노트 상세' 추가
- Fix: TypeScript의 타입 체크 대상 파일을 한정하여 빌드를 고속화하도록 (Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/725)

Server:
- Fix: sharedInbox가 없는 Actor에 연결된 리모트 유저를 조회할 수 없음
- Fix: Aproving request from GtS appears with some delay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛Bug Unexpected behavior packages/backend Server side specific issue/PR
Projects
None yet
2 participants