enhance: 招待機能の改善 (#11195)

* refactor(backend): 招待機能を改修

* feat(backend): 招待コードのcreate/delete/listエンドポイントを追加

* add(misskey-js): エンドポイントと型を追加

* change(backend): metaでinvite関連の情報も返すように

* add(misskey-js): エンドポイントと型を追加

* add(backend): `/endpoints/invite/limit`を追加

* fix: createdByがnullableではなかったのを修正

* fix: relationが取得できていなかった問題を修正

* fix: パラメータを間違えていたのを修正

* feat(client): 招待ページを実装

* change(client): インスタンスメニューの「招待」押した場合に招待ページに飛ぶように変更

* feat: 招待コードをコピーできるように

* change(backend): metaに招待コード発行に関する情報を持たせるのをやめる

* feat: ロールごとに招待コードの発行上限数などを設定できるように

* change(client): 招待コードをコピーしたときにダイアログを出すように

* add: 招待に関する管理者用のエンドポイントを追加

* change(backend): モデレーターであれば作成者以外でも招待コードを削除できるように

* change(backend): admin/invite/listはオフセットでページネーションするように

* feat(client): 招待コードの管理ページを追加

* feat(client): 招待コードのリストをソートできるように

* change: `admin/invite/create`のレスポンスを修正

* fix(client): 有効期限を指定できていなかった問題を修正

* refactor: 必要のない箇所を削除

* perf(backend): use limit() instead of take()

* change(client): 作成ボタンを見た目を変更

* refactor: 招待コードの生成部分を共通化し、コード内に"01OI"のいずれかの文字を含まないように

* fix(client): paginationの仕様が変わっていたので修正

* change(backend): expiresAtパラメータのnullを許容

* change(client): 有効期限を設けないときは日付の入力欄を非表示に

* fix: 自身のポリシーよりもインスタンス側のポリシーが優先表示される問題を修正

* fix: n時間のときに「n時間間」となってしまうのを修正

* fix(backend): ポリシーが途中で変更されたときに作成可能数がマイナス表記になってしまうのを修正

* change(client): 招待コードのユーザー名が不明な理由を表示するように

* update: CHANGELOG.md

* lint

* refactor

* refactor

* tweak ui

* 🎨

* 🎨

* add(backend): indexを追加

* change(backend): indexの追加に伴う変更

* change(client): インスタンスメニューの「招待」の場所を変更

* add(frontend): MkInviteCode用のstorybookを追加

* Update misskey-js.api.md

* fix(misskey-js): InviteのcreatedByの型が間違っていたのを修正

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
This commit is contained in:
yukineko 2023-07-15 09:57:58 +09:00 committed by GitHub
parent 1c82e97350
commit 02957a1b5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 1341 additions and 56 deletions

View file

@ -481,6 +481,14 @@ export type Endpoints = {
req: TODO;
res: TODO;
};
'admin/invite/create': {
req: TODO;
res: TODO;
};
'admin/invite/list': {
req: TODO;
res: TODO;
};
'admin/moderators/add': {
req: TODO;
res: TODO;
@ -1549,6 +1557,28 @@ export type Endpoints = {
req: TODO;
res: TODO;
};
'invite/create': {
req: NoParams;
res: Invite;
};
'invite/delete': {
req: {
inviteId: Invite['id'];
};
res: null;
};
'invite/list': {
req: {
limit?: number;
sinceId?: Invite['id'];
untilId?: Invite['id'];
};
res: Invite[];
};
'invite/limit': {
req: NoParams;
res: InviteLimit;
};
'messaging/history': {
req: {
limit?: number;
@ -2210,6 +2240,8 @@ declare namespace entities {
Blocking,
Instance,
Signin,
Invite,
InviteLimit,
UserSorting,
OriginType
}
@ -2310,6 +2342,23 @@ type Instance = {
// @public (undocumented)
type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata;
// @public (undocumented)
type Invite = {
id: ID;
code: string;
expiresAt: DateString | null;
createdAt: DateString;
createdBy: UserLite | null;
usedBy: UserLite | null;
usedAt: DateString | null;
used: boolean;
};
// @public (undocumented)
type InviteLimit = {
remaining: number;
};
// @public (undocumented)
function isAPIError(reason: any): reason is APIError;
@ -2756,7 +2805,7 @@ type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+u
//
// src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
// src/api.types.ts:620:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/api.types.ts:628:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts
// (No @packageDocumentation comment for this package)

View file

@ -2,7 +2,7 @@ import type {
Ad, Announcement, Antenna, App, AuthSession, Blocking, Channel, Clip, DateString, DetailedInstanceMetadata, DriveFile, DriveFolder, Following, FollowingFolloweePopulated, FollowingFollowerPopulated, FollowRequest, GalleryPost, Instance,
LiteInstanceMetadata,
MeDetailed,
Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, MeSignup, UserGroup, UserList, UserSorting, Notification, NoteReaction, Signin, MessagingMessage,
Note, NoteFavorite, OriginType, Page, ServerInfo, Stats, User, UserDetailed, MeSignup, UserGroup, UserList, UserSorting, Notification, NoteReaction, Signin, MessagingMessage, Invite, InviteLimit,
} from './entities.js';
type TODO = Record<string, any> | null;
@ -57,6 +57,8 @@ export type Endpoints = {
'admin/federation/refresh-remote-instance-metadata': { req: TODO; res: TODO; };
'admin/federation/remove-all-following': { req: TODO; res: TODO; };
'admin/federation/update-instance': { req: TODO; res: TODO; };
'admin/invite/create': { req: TODO; res: TODO; };
'admin/invite/list': { req: TODO; res: TODO; };
'admin/moderators/add': { req: TODO; res: TODO; };
'admin/moderators/remove': { req: TODO; res: TODO; };
'admin/promo/create': { req: TODO; res: TODO; };
@ -440,6 +442,12 @@ export type Endpoints = {
'i/2fa/remove-key': { req: TODO; res: TODO; };
'i/2fa/unregister': { req: TODO; res: TODO; };
// invite
'invite/create': { req: NoParams; res: Invite; };
'invite/delete': { req: { inviteId: Invite['id']; }; res: null; };
'invite/list': { req: { limit?: number; sinceId?: Invite['id']; untilId?: Invite['id'] }; res: Invite[]; };
'invite/limit': { req: NoParams; res: InviteLimit; };
// messaging
'messaging/history': { req: { limit?: number; group?: boolean; }; res: MessagingMessage[]; };
'messaging/messages': { req: { userId?: User['id']; groupId?: UserGroup['id']; limit?: number; sinceId?: MessagingMessage['id']; untilId?: MessagingMessage['id']; markAsRead?: boolean; }; res: MessagingMessage[]; };

View file

@ -516,6 +516,21 @@ export type Signin = {
success: boolean;
};
export type Invite = {
id: ID;
code: string;
expiresAt: DateString | null;
createdAt: DateString;
createdBy: UserLite | null;
usedBy: UserLite | null;
usedAt: DateString | null;
used: boolean;
}
export type InviteLimit = {
remaining: number;
}
export type UserSorting =
| '+follower'
| '-follower'