diff --git a/webapp/channels/src/components/external_link/external_link.test.tsx b/webapp/channels/src/components/external_link/external_link.test.tsx
index 756cb743f8..67e237286d 100644
--- a/webapp/channels/src/components/external_link/external_link.test.tsx
+++ b/webapp/channels/src/components/external_link/external_link.test.tsx
@@ -161,4 +161,33 @@ describe('components/external_link', () => {
expect.stringMatching('test'),
);
});
+
+ it('renders href correctly when url contains anchor by setting anchor at the end', () => {
+ const state = {
+ ...initialState,
+ entities: {
+ ...initialState.entities,
+ general: {
+ ...initialState?.entities?.general,
+ config: {
+ DiagnosticsEnabled: 'true',
+ },
+ },
+ },
+ };
+ const store: GlobalState = JSON.parse(JSON.stringify(state));
+ renderWithIntlAndStore(
+
+ {'Click Me'}
+ ,
+ store,
+ );
+
+ expect(screen.queryByText('Click Me')).toHaveAttribute(
+ 'href',
+ 'https://mattermost.com?utm_source=mattermost&utm_medium=in-product-cloud&utm_content=&uid=currentUserId&sid=#desktop',
+ );
+ });
});
diff --git a/webapp/channels/src/components/external_link/index.tsx b/webapp/channels/src/components/external_link/index.tsx
index d72779e212..76e34aff6f 100644
--- a/webapp/channels/src/components/external_link/index.tsx
+++ b/webapp/channels/src/components/external_link/index.tsx
@@ -52,7 +52,11 @@ export default function ExternalLink(props: Props) {
// If the href already has query params, remove them before adding them back with the addition of the new ones
href = href?.split('?')[0];
}
- href = `${href}?${queryString}`;
+ const anchor = new URL(href).hash;
+ if (anchor) {
+ href = href.replace(anchor, '');
+ }
+ href = `${href}?${queryString}${anchor ?? ''}`;
}
const handleClick = (e: React.MouseEvent) => {
diff --git a/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.tsx b/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.tsx
index f584541422..790602fe1a 100644
--- a/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.tsx
+++ b/webapp/channels/src/components/onboarding_tasklist/onboarding_tasklist_completed.tsx
@@ -49,7 +49,7 @@ const CompletedWrapper = styled.div`
&.fade-exit-done {
transform: scale(1);
}
- .start-trial-btn {
+ .start-trial-btn, .got-it-button {
padding: 13px 20px;
background: var(--button-bg);
border-radius: 4px;
@@ -223,7 +223,10 @@ const Completed = (props: Props): JSX.Element => {
>
) : (
-