refactor(api): move 10 profile methods to ProfileApi (#6 commit 8/13)
Inlines `actions/profile.ts` into `apis/profile.ts::ProfileApi`. The
file covers personal profile (nickname / long-nick / personal note),
online status (regular + DIY with custom face/wording), avatars
(personal + group via highway), input-status, likes (received from
others), unidirectional friend list, and custom face roaming.
Method renaming (Api namespace already says "profile"):
getProfileLike → getLike (only obvious shortening; rest keep
their `set*`/`fetch*` prefixes because
they're already minimal at the call
site under `apis.profile.X`)
Callers updated: `instance-context.ts`, `actions/group-admin.ts`,
`actions/extended.ts`. The extended-actions test gained a sizable
`APIS_ROUTING` block covering profile/interaction/friend (all of the
late-stage Api hubs need auto-promotion now), so legacy tests that
stub `setDiyOnlineStatus`/`setOnlineStatus`/`deleteFriend`/etc as flat
methods keep working.
Tests rewritten to use `new ProfileApi(bridge as any).method(...)`.
587/587 tests pass.
This commit is contained in:
1 parent
2ec72d59f9
commit
62c5590fe1
10 files changed
+335
-381
No files matched your search
@@ -44,6 +44,24 @@ const APIS_ROUTING: Record<string, [string, string]> = {
|
||||
// the area name already says it.
|
||||
deleteGroupFileFolder: ['groupFile', 'deleteFolder'],
|
||||
fetchGroupPttUrlByNode: ['groupFile', 'getPttUrl'],
|
||||
// InteractionApi: methods drop the redundant `Group` prefix.
|
||||
sendLike: ['interaction', 'sendLike'],
|
||||
setGroupReaction: ['interaction', 'setReaction'],
|
||||
// ProfileApi: a few methods rename (getProfileLike → getLike).
|
||||
setOnlineStatus: ['profile', 'setOnlineStatus'],
|
||||
setDiyOnlineStatus: ['profile', 'setDiyOnlineStatus'],
|
||||
setProfile: ['profile', 'setProfile'],
|
||||
setSelfLongNick: ['profile', 'setSelfLongNick'],
|
||||
setInputStatus: ['profile', 'setInputStatus'],
|
||||
setAvatar: ['profile', 'setAvatar'],
|
||||
setGroupAvatar: ['profile', 'setGroupAvatar'],
|
||||
fetchCustomFace: ['profile', 'fetchCustomFace'],
|
||||
getProfileLike: ['profile', 'getLike'],
|
||||
getUnidirectionalFriendList: ['profile', 'getUnidirectionalFriendList'],
|
||||
// FriendApi: handleRequest/delete/setRemark.
|
||||
setFriendRemark: ['friend', 'setRemark'],
|
||||
deleteFriend: ['friend', 'delete'],
|
||||
setFriendAddRequest: ['friend', 'handleRequest'],
|
||||
};
|
||||
|
||||
function fakeBridge(overrides: Record<string, any> = {}): BridgeInterface {
|
||||
|
||||
Reference in new issue
Block a user