返回提交历史
Modified
src/controllers/api/getGuildLogController.ts
+4
-1
Modified
src/controllers/api/removeFriendController.ts
+2
-2
Modified
src/controllers/api/removeFromGuildController.ts
+10
-3
XFEstudio/XFESpaceNinjaServer
chore: update removeFromGuild response for U40 (#3577)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3577 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
ae33cb0f
代码差异
3 个文件
+16
-6
@@ -63,7 +63,10 @@ interface IGuildLogEntryClient {
63
63
const cleanupDetails = (details: number | string, buildLabel: string | undefined): number | string => {
64
64
if (typeof details == "string" && buildLabel && version_compare(buildLabel, gameToBuildVersion["32.0.0"]) < 0) {
65
65
// Remove the number suffix so pre-U32 clients don't show it. U32+ clients currently don't show it because we don't set CrossPlatformEnabled to true.
66
return details.split("#")[0];
66
return details
67
.split(",")
68
.map(x => x.split("#")[0])
69
.join(",");
67
70
}
68
71
return details;
69
72
};
@@ -90,12 +90,12 @@ interface IBatchRemoveFriendsRequest {
90
90
SkipFriendIds: string[];
91
91
}
92
92
93
// >= U40
93
// >= U40 needs unicode-suffixed name to send social notify over IRC
94
94
interface IRemoveFriendsResponseU40 {
95
95
FriendNames: string[];
96
96
}
97
97
98
// < U40
98
// < U40 needs oid to send social notify over NRS
99
99
interface IRemoveFriendsResponseU39 {
100
100
Friends: IOidWithLegacySupport[];
101
101
}
@@ -9,7 +9,12 @@ import {
9
9
} from "../../services/guildService.ts";
10
10
import { createMessage } from "../../services/inboxService.ts";
11
11
import { getInventory } from "../../services/inventoryService.ts";
12
import { getAccountForRequest, getSuffixedName, type TAccountDocument } from "../../services/loginService.ts";
12
import {
13
getAccountForRequest,
14
getSuffixedName,
15
getUnicodeName,
16
type TAccountDocument
17
} from "../../services/loginService.ts";
13
18
import { sendWsBroadcastTo } from "../../services/wsService.ts";
14
19
import { GuildPermission } from "../../types/guildTypes.ts";
15
20
import type { RequestHandler, Response } from "express";
@@ -47,6 +52,8 @@ const processRemoveFromGuildRequest = async (
47
52
return;
48
53
}
49
54
55
const accountOfRemovedMember = isKick ? (await Account.findById(payload.userId))! : account;
56
50
57
const guildMember = await GuildMember.findOne({ accountId: payload.userId, guildId: guild._id });
51
58
if (guildMember) {
52
59
if (guildMember.rank == 0) {
@@ -89,11 +96,10 @@ const processRemoveFromGuildRequest = async (
89
96
90
97
guild.RosterActivity ??= [];
91
98
if (isKick) {
92
const kickee = (await Account.findById(payload.userId))!;
93
99
guild.RosterActivity.push({
94
100
dateTime: new Date(),
95
101
entryType: 12,
96
details: getSuffixedName(kickee) + "," + getSuffixedName(account)
102
details: getSuffixedName(accountOfRemovedMember) + "," + getSuffixedName(account)
97
103
});
98
104
} else {
99
105
guild.RosterActivity.push({
@@ -108,6 +114,7 @@ const processRemoveFromGuildRequest = async (
108
114
109
115
res.json({
110
116
_id: payload.userId,
117
Name: getUnicodeName(accountOfRemovedMember, account.BuildLabel), // U40+ needs this to send social notify over IRC
111
118
ItemToRemove: "/Lotus/Types/Keys/DojoKey",
112
119
RecipeToRemove: "/Lotus/Types/Keys/DojoKeyBlueprint"
113
120
});