FIX: Follow open in new tab site setting for bio links (#11418)

This commit is contained in:
Bianca Nenciu 2020-12-08 01:56:14 +02:00 committed by GitHub
parent 5ab6ef9765
commit 812d047c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,23 @@
import {
openLinkInNewTab,
shouldOpenInNewTab,
} from "discourse/lib/click-track";
import Component from "@ember/component";
export default Component.extend({
didInsertElement() {
this._super(...arguments);
$(this.element).on("click.discourse-open-tab", "a", (event) => {
if (event.target && event.target.tagName === "A") {
if (shouldOpenInNewTab(event.target.href)) {
openLinkInNewTab(event.target);
}
}
});
},
willDestroyElement() {
this._super(...arguments);
$(this.element).off("click.discourse-open-tab", "a");
},
});

View File

@ -142,7 +142,11 @@
</div>
{{else}}
{{#if this.user.bio_excerpt}}
<div class="bio">{{html-safe this.user.bio_excerpt}}</div>
<div class="bio">
{{#html-with-links}}
{{html-safe this.user.bio_excerpt}}
{{/html-with-links}}
</div>
{{/if}}
{{/if}}
</div>

View File

@ -144,7 +144,9 @@
</div>
{{/if}}
{{#if isNotSuspendedOrIsStaff}}
{{html-safe model.bio_cooked}}
{{#html-with-links}}
{{html-safe model.bio_cooked}}
{{/html-with-links}}
{{/if}}
</div>