Skip to content

Commit 9b197f6

Browse files
committed
Rename getUsername to getLoggedInUser
1 parent 968a6cb commit 9b197f6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ TEST: addTests('isTeamDiscussion', [
196196
'https://github.com/orgs/refined-github/teams/core-team',
197197
]);
198198

199-
export const isOwnUserProfile = (): boolean => getCleanPathname() === getUsername();
199+
export const isOwnUserProfile = (): boolean => getCleanPathname() === getLoggedInUser();
200200

201201
// If there's a Report Abuse link, we're not part of the org
202202
export const isOwnOrganizationProfile = (): boolean => isOrganizationProfile() && !exists('[href*="contact/report-abuse?report="]');
@@ -749,7 +749,7 @@ TEST: addTests('isNewRepoTemplate', [
749749
]);
750750

751751
/** Get the logged-in user’s username */
752-
const getUsername = (): string | undefined => $('meta[name="user-login"]')?.getAttribute('content') ?? undefined;
752+
const getLoggedInUser = (): string | undefined => $('meta[name="user-login"]')?.getAttribute('content') ?? undefined;
753753

754754
/** Drop all duplicate slashes */
755755
const getCleanPathname = (url: URL | HTMLAnchorElement | Location = location): string => url.pathname.replaceAll(/\/+/g, '/').slice(1, url.pathname.endsWith('/') ? -1 : undefined);
@@ -825,7 +825,9 @@ const getRepo = (url?: URL | HTMLAnchorElement | Location | string): RepositoryI
825825

826826
export const utils = {
827827
getOrg,
828-
getUsername,
828+
/** @deprecated Use `getLoggedInUser` */
829+
getUsername: getLoggedInUser,
830+
getLoggedInUser,
829831
getCleanPathname,
830832
getCleanGistPathname,
831833
getRepositoryInfo: getRepo,

0 commit comments

Comments
 (0)