Skip to content

Commit

Permalink
fixup! fix(Minds): dom gets updated (#10910)
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleBill committed Oct 8, 2023
1 parent 8cb3aa5 commit fa52d87
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ async function resolveLastRecognizedIdentityInner(
cancel: AbortSignal,
) {
const assign = async () => {
const handle = selfInfoSelectors().handle
const avatar = selfInfoSelectors().avatar
const { handle, avatar } = selfInfoSelectors()

ref.value = {
identifier: ProfileIdentifier.of(mindsBase.networkIdentifier, handle).unwrapOr(undefined),
Expand Down
7 changes: 6 additions & 1 deletion packages/mask/src/site-adaptors/minds.com/utils/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ export const postIdParser = (node: HTMLElement) => {
export const postNameParser = (node: HTMLElement) => {
return parseNameArea(
assertNonNull(
node.querySelector<HTMLAnchorElement>('m-activity__ownerblock .m-activityOwnerBlock__primaryName'),
node.querySelector<HTMLAnchorElement>(
[
'm-activity__ownerblock .m-activityOwnerBlock__primaryName',
'm-activity__ownerblock .m-activityOwnerBlock__secondaryName', // It's `secondaryName` in detail page
].join(','),
),
),
)
}
Expand Down
5 changes: 3 additions & 2 deletions packages/mask/src/site-adaptors/minds.com/utils/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ export const postEditorDraftContentSelector = () => {
return querySelector<HTMLElement>('m-composer__modal m-composer__textarea textarea.m-composerTextarea__message')
}

export const handleSelector = () => querySelector('.m-sidebarNavigation__item--user > a > div > span')
export const handleSelector = () =>
querySelector<HTMLAnchorElement>('.m-sidebarNavigation__item--user [data-ref="sidenav-channel"]')

export const selfInfoSelectors = () => ({
handle: handleSelector().evaluate()?.innerText.trim(),
handle: handleSelector().evaluate()?.getAttribute('href')?.slice(1),
avatar: querySelector<HTMLImageElement>('.m-sidebarNavigation__item--user > a > div > img').evaluate()?.src,
})

Expand Down

0 comments on commit fa52d87

Please sign in to comment.