0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Added outbound link tagging setting (#16324)

no issue

Enable or disable outbound link tagging in both web posts and
newsletters.
This commit is contained in:
Simon Backx 2023-02-23 14:37:23 +01:00 committed by GitHub
parent ff3568293c
commit 3ded0bbee8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 23 deletions

View file

@ -74,7 +74,6 @@
</div>
</div>
</div>
{{#if (feature 'outboundLinkTagging')}}
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>
@ -97,6 +96,5 @@
</div>
</div>
</div>
{{/if}}
</section>
</div>

View file

@ -69,7 +69,6 @@ export default class FeatureService extends Service {
@feature('emailStability') emailStability;
@feature('webmentions') webmentions;
@feature('webmentionEmails') webmentionEmails;
@feature('outboundLinkTagging') outboundLinkTagging;
@feature('emailErrors') emailErrors;
@feature('milestoneEmails') milestoneEmails;
@feature('websockets') websockets;

View file

@ -226,19 +226,6 @@
</div>
</div>
</div>
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>
<h4 class="gh-expandable-title">Outbound Link Tagging</h4>
<p class="gh-expandable-description">
Adds ?ref to external links in web posts and adds a setting to control this for both web and newsletters.
</p>
</div>
<div class="for-switch">
<GhFeatureFlag @flag="outboundLinkTagging" />
</div>
</div>
</div>
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>

View file

@ -1,6 +1,5 @@
import {authenticateSession} from 'ember-simple-auth/test-support';
import {click, find} from '@ember/test-helpers';
import {enableLabsFlag} from '../../helpers/labs-flag';
import {expect} from 'chai';
import {setupApplicationTest} from 'ember-mocha';
import {setupMirage} from 'ember-cli-mirage/test-support';
@ -65,7 +64,6 @@ describe('Acceptance: Settings - Analytics', function () {
});
it('can manage outbound link tagging', async function () {
enableLabsFlag(this.server, 'outboundLinkTagging');
this.server.db.settings.update({key: 'outbound_link_tagging'}, {value: 'true'});
await visit('/settings/analytics');

View file

@ -21,7 +21,8 @@ const GA_FEATURES = [
'audienceFeedback',
'themeErrorsNotification',
'emailStability',
'emailErrors'
'emailErrors',
'outboundLinkTagging'
];
// NOTE: this allowlist is meant to be used to filter out any unexpected
@ -36,7 +37,6 @@ const ALPHA_FEATURES = [
'urlCache',
'beforeAfterCard',
'lexicalEditor',
'outboundLinkTagging',
'websockets',
'webmentionEmails'
];

View file

@ -654,7 +654,7 @@ exports[`Settings API Edit Can edit a setting 2: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "3653",
"content-length": "3682",
"content-type": "application/json; charset=utf-8",
"content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/,
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,

View file

@ -6,6 +6,7 @@ const urlUtil = require('../../../../../../../core/server/api/endpoints/utils/se
const cleanUtil = require('../../../../../../../core/server/api/endpoints/utils/serializers/output/utils/clean');
const extraAttrsUtils = require('../../../../../../../core/server/api/endpoints/utils/serializers/output/utils/extra-attrs');
const mappers = require('../../../../../../../core/server/api/endpoints/utils/serializers/output/mappers');
const memberAttribution = require('../../../../../../../core/server/services/member-attribution');
function createJsonModel(data) {
return Object.assign(data, {toJSON: sinon.stub().returns(data)});
@ -29,9 +30,13 @@ describe('Unit: utils/serializers/output/mappers', function () {
sinon.stub(cleanUtil, 'post').returns({});
sinon.stub(cleanUtil, 'tag').returns({});
sinon.stub(cleanUtil, 'author').returns({});
memberAttribution.outboundLinkTagger = {
addToHtml: sinon.stub().callsFake(html => Promise.resolve(html))
};
});
it('calls mapper on relations', function () {
it('calls mapper on relations', async function () {
const frame = {
original: {
context: {}
@ -57,7 +62,7 @@ describe('Unit: utils/serializers/output/mappers', function () {
}]
}));
mappers.posts(post, frame);
await mappers.posts(post, frame);
dateUtil.forPost.callCount.should.equal(1);