@heylemon/lemonade 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d27c866a9f91a1bf3b7a29bef001583ee57f61540140511ed6840c4b5dfcd5eb
|
|
@@ -21,6 +21,7 @@ export function resolveSlackAllowListMatch(params) {
|
|
|
21
21
|
}
|
|
22
22
|
const id = params.id?.toLowerCase();
|
|
23
23
|
const name = params.name?.toLowerCase();
|
|
24
|
+
const email = params.email?.toLowerCase();
|
|
24
25
|
const slug = normalizeSlackSlug(name);
|
|
25
26
|
const candidates = [
|
|
26
27
|
{ value: id, source: "id" },
|
|
@@ -29,6 +30,7 @@ export function resolveSlackAllowListMatch(params) {
|
|
|
29
30
|
{ value: name, source: "name" },
|
|
30
31
|
{ value: name ? `slack:${name}` : undefined, source: "prefixed-name" },
|
|
31
32
|
{ value: slug, source: "slug" },
|
|
33
|
+
{ value: email, source: "email" },
|
|
32
34
|
];
|
|
33
35
|
for (const candidate of candidates) {
|
|
34
36
|
if (!candidate.value)
|
|
@@ -98,7 +98,8 @@ export function createSlackMonitorContext(params) {
|
|
|
98
98
|
});
|
|
99
99
|
const profile = info.user?.profile;
|
|
100
100
|
const name = profile?.display_name || profile?.real_name || info.user?.name || undefined;
|
|
101
|
-
const
|
|
101
|
+
const email = profile?.email || undefined;
|
|
102
|
+
const entry = { name, email };
|
|
102
103
|
userCache.set(userId, entry);
|
|
103
104
|
return entry;
|
|
104
105
|
}
|
|
@@ -96,24 +96,26 @@ export async function prepareSlackMessage(params) {
|
|
|
96
96
|
return null;
|
|
97
97
|
}
|
|
98
98
|
if (ctx.dmPolicy !== "open") {
|
|
99
|
+
const dmSender = await ctx.resolveUserName(directUserId);
|
|
100
|
+
const dmSenderEmail = dmSender?.email ?? undefined;
|
|
99
101
|
const allowMatch = resolveSlackAllowListMatch({
|
|
100
102
|
allowList: allowFromLower,
|
|
101
103
|
id: directUserId,
|
|
104
|
+
email: dmSenderEmail,
|
|
102
105
|
});
|
|
103
106
|
const allowMatchMeta = formatAllowlistMatchMeta(allowMatch);
|
|
104
107
|
if (!allowMatch.allowed) {
|
|
105
|
-
// Check if sender is an approved guest (responses only, no tools)
|
|
106
108
|
const guestMatch = resolveSlackAllowListMatch({
|
|
107
109
|
allowList: guestFromLower,
|
|
108
110
|
id: directUserId,
|
|
111
|
+
email: dmSenderEmail,
|
|
109
112
|
});
|
|
110
113
|
if (guestMatch.allowed) {
|
|
111
114
|
isGuestSender = true;
|
|
112
115
|
logVerbose(`slack: guest sender ${directUserId} allowed (responses only, no tools)`);
|
|
113
116
|
}
|
|
114
117
|
else if (ctx.dmPolicy === "pairing" || ctx.dmPolicy === "allowlist") {
|
|
115
|
-
const
|
|
116
|
-
const senderName = sender?.name ?? undefined;
|
|
118
|
+
const senderName = dmSender?.name ?? undefined;
|
|
117
119
|
const { created } = await upsertChannelPairingRequest({
|
|
118
120
|
channel: "slack",
|
|
119
121
|
id: directUserId,
|
|
@@ -226,6 +228,7 @@ export async function prepareSlackMessage(params) {
|
|
|
226
228
|
allowList: allowFromLower,
|
|
227
229
|
id: senderId,
|
|
228
230
|
name: senderName,
|
|
231
|
+
email: sender?.email,
|
|
229
232
|
}).allowed;
|
|
230
233
|
const channelUsersAllowlistConfigured = isRoom && Array.isArray(channelConfig?.users) && channelConfig.users.length > 0;
|
|
231
234
|
const channelCommandAuthorized = isRoom && channelUsersAllowlistConfigured
|