forked from misskey-dev/misskey
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 送信したフォローリクエストを確認できるように (misskey-dev#14856)
* FEAT: Allow users to view pending follow requests they sent This commit implements the `following/requests/sent` interface firstly implemented on Firefish, and provides a UI interface to view the pending follow requests users sent. * ux: should not show follow requests tab when have no pending sent follow req * fix default followreq tab * fix default followreq tab * restore missing hasPendingReceivedFollowRequest in navbar * refactor * use tabler icons * tweak design * Revert "ux: should not show follow requests tab when have no pending sent follow req" This reverts commit e580b92. * Update Changelog * Update Changelog * change tab titles --------- Co-authored-by: Lhc_fl <[email protected]> Co-authored-by: Hazelnoot <[email protected]>
- Loading branch information
1 parent
e26e24b
commit c0d1682
Showing
14 changed files
with
272 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
packages/backend/src/server/api/endpoints/following/requests/sent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* SPDX-FileCopyrightText: syuilo and misskey-project | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
import { Inject, Injectable } from '@nestjs/common'; | ||
import { Endpoint } from '@/server/api/endpoint-base.js'; | ||
import { QueryService } from '@/core/QueryService.js'; | ||
import type { FollowRequestsRepository } from '@/models/_.js'; | ||
import { FollowRequestEntityService } from '@/core/entities/FollowRequestEntityService.js'; | ||
import { DI } from '@/di-symbols.js'; | ||
|
||
export const meta = { | ||
tags: ['following', 'account'], | ||
|
||
requireCredential: true, | ||
|
||
kind: 'read:following', | ||
|
||
res: { | ||
type: 'array', | ||
optional: false, nullable: false, | ||
items: { | ||
type: 'object', | ||
optional: false, nullable: false, | ||
properties: { | ||
id: { | ||
type: 'string', | ||
optional: false, nullable: false, | ||
format: 'id', | ||
}, | ||
follower: { | ||
type: 'object', | ||
optional: false, nullable: false, | ||
ref: 'UserLite', | ||
}, | ||
followee: { | ||
type: 'object', | ||
optional: false, nullable: false, | ||
ref: 'UserLite', | ||
}, | ||
}, | ||
}, | ||
}, | ||
} as const; | ||
|
||
export const paramDef = { | ||
type: 'object', | ||
properties: { | ||
sinceId: { type: 'string', format: 'misskey:id' }, | ||
untilId: { type: 'string', format: 'misskey:id' }, | ||
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, | ||
}, | ||
required: [], | ||
} as const; | ||
|
||
@Injectable() | ||
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export | ||
constructor( | ||
@Inject(DI.followRequestsRepository) | ||
private followRequestsRepository: FollowRequestsRepository, | ||
|
||
private followRequestEntityService: FollowRequestEntityService, | ||
private queryService: QueryService, | ||
) { | ||
super(meta, paramDef, async (ps, me) => { | ||
const query = this.queryService.makePaginationQuery(this.followRequestsRepository.createQueryBuilder('request'), ps.sinceId, ps.untilId) | ||
.andWhere('request.followerId = :meId', { meId: me.id }); | ||
|
||
const requests = await query | ||
.limit(ps.limit) | ||
.getMany(); | ||
|
||
return await this.followRequestEntityService.packMany(requests, me); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.