feat: 個人宛てお知らせ機能 (#107)
* feat: 個人宛てお知らせ機能 * Remove unused import * Update packages/backend/src/server/api/endpoints/admin/announcements/create.ts Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com> * Update packages/frontend/src/pages/announcements.vue Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com> * Restore breakline * 一般向けAPIにはuserオブジェクトを提供しない * fix * Fix * Update packages/misskey-js/src/entities.ts Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com> * Fix * Update misskey-js.api.md * Fix lint * 他のテーブルに合わせて character varying(32) にした * count クエリを1つにまとめた * user を pack するようにした * いろいろ修正 * 個人宛てのお知らせの表示を改善 * Update misskey-js.api.md * Merge migration scripts * Fix * Update packages/backend/migration/1688647797135-userannouncement.js Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com> * Update packages/backend/src/models/entities/Announcement.ts Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com> * Fix * Update migration script --------- Co-authored-by: CyberRex <hspwinx86@gmail.com> Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| import { Inject, Injectable } from '@nestjs/common'; | ||||
| import { In, Not } from 'typeorm'; | ||||
| import { In, IsNull, Not } from 'typeorm'; | ||||
| import * as Redis from 'ioredis'; | ||||
| import _Ajv from 'ajv'; | ||||
| import { ModuleRef } from '@nestjs/core'; | ||||
| @@ -218,9 +218,11 @@ export class UserEntityService implements OnModuleInit { | ||||
| 			userId: userId, | ||||
| 		}); | ||||
|  | ||||
| 		const count = await this.announcementsRepository.countBy(reads.length > 0 ? { | ||||
| 			id: Not(In(reads.map(read => read.announcementId))), | ||||
| 		} : {}); | ||||
| 		const id = reads.length > 0 ? Not(In(reads.map(read => read.announcementId))) : undefined; | ||||
| 		const count = await this.announcementsRepository.countBy([ | ||||
| 			{ id, userId: IsNull() }, | ||||
| 			{ id, userId: userId }, | ||||
| 		]); | ||||
|  | ||||
| 		return count > 0; | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 riku6460
					riku6460