chore(social-client): drop redundant comment, harden defineProperty
Per code-review: - Drop the inline comment in sendFriendRequest; the commit message for the prior commit already covers the why and CLAUDE.md prefers no comments when the code is self-explanatory. - Add writable: true to the window.location defineProperty in the test so re-firing beforeEach across jsdom version drift is safe.
This commit is contained in:
@@ -51,6 +51,7 @@ describe('socialStore.sendFriendRequest — case-insensitive domain routing', ()
|
|||||||
// Override it for routing tests.
|
// Override it for routing tests.
|
||||||
Object.defineProperty(window, 'location', {
|
Object.defineProperty(window, 'location', {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
|
writable: true,
|
||||||
value: { ...window.location, host: 'local.test', hostname: 'local.test' },
|
value: { ...window.location, host: 'local.test', hostname: 'local.test' },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -218,7 +218,6 @@ export const useSocialStore = create<SocialState>((set, get) => ({
|
|||||||
res = await api.social.sendRequest(username);
|
res = await api.social.sendRequest(username);
|
||||||
} else {
|
} else {
|
||||||
const baseName = username.slice(0, atIndex);
|
const baseName = username.slice(0, atIndex);
|
||||||
// Hostnames are case-insensitive; comparison RHS is canonical lowercase.
|
|
||||||
const domain = username.slice(atIndex + 1).toLowerCase();
|
const domain = username.slice(atIndex + 1).toLowerCase();
|
||||||
|
|
||||||
// Check if domain matches home instance
|
// Check if domain matches home instance
|
||||||
|
|||||||
Reference in New Issue
Block a user