From b9b1502772dc5dd3d7b7b8b67875afdc04f4f30b Mon Sep 17 00:00:00 2001 From: Nick Moreton Date: Tue, 7 Nov 2023 09:52:28 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9BChanged=20"free=5Fsignups"=20to=20"?= =?UTF-8?q?signups"=20in=20Post=20Exporter=20(#18883)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref https://github.com/TryGhost/Product/issues/4110 Made this change to increase clarity in data export --- ### 🤖 Generated by Copilot at 6c0508d Renamed a column in posts export data and updated the corresponding test case. This change makes the export data more consistent and clear for users who have different member features enabled. --- .../admin/__snapshots__/posts.test.js.snap | 16 ++++++++-------- ghost/posts-service/lib/PostsExporter.js | 4 ++-- ghost/posts-service/test/PostsExporter.test.js | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ghost/core/test/e2e-api/admin/__snapshots__/posts.test.js.snap b/ghost/core/test/e2e-api/admin/__snapshots__/posts.test.js.snap index 585ec0e981..f4628112bf 100644 --- a/ghost/core/test/e2e-api/admin/__snapshots__/posts.test.js.snap +++ b/ghost/core/test/e2e-api/admin/__snapshots__/posts.test.js.snap @@ -1789,7 +1789,7 @@ 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-disposition": StringMatching /\\^Attachment; filename="post-analytics\\.\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}\\.csv"\\$/, - "content-length": "2721", + "content-length": "2716", "content-type": "text/csv; charset=utf-8", "content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, @@ -1800,7 +1800,7 @@ Object { exports[`Posts API Export Can export 2 1`] = ` Object { - "text": "id,title,url,author,status,created_at,updated_at,published_at,featured,tags,post_access,email_recipients,sends,opens,clicks,free_signups,paid_conversions + "text": "id,title,url,author,status,created_at,updated_at,published_at,featured,tags,post_access,email_recipients,sends,opens,clicks,signups,paid_conversions 6194d3ce51e2700162531a77,Start here for a quick overview of everything you need to know,http://127.0.0.1:2369/welcome/,Ghost,published only,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,false,Getting Started,Public,,,,,0,0 6194d3ce51e2700162531a76,Customizing your brand and design settings,http://127.0.0.1:2369/design/,Ghost,published only,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,false,Getting Started,Public,,,,,0,0 6194d3ce51e2700162531a75,\\"Writing and managing content in Ghost, an advanced guide\\",http://127.0.0.1:2369/write/,Ghost,published only,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,false,Getting Started,Public,,,,,0,0 @@ -1820,7 +1820,7 @@ 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-disposition": StringMatching /\\^Attachment; filename="post-analytics\\.\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}\\.csv"\\$/, - "content-length": "587", + "content-length": "582", "content-type": "text/csv; charset=utf-8", "content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, @@ -1831,7 +1831,7 @@ Object { exports[`Posts API Export Can export with filter 2 1`] = ` Object { - "text": "id,title,url,author,status,created_at,updated_at,published_at,featured,tags,post_access,email_recipients,sends,opens,clicks,free_signups,paid_conversions + "text": "id,title,url,author,status,created_at,updated_at,published_at,featured,tags,post_access,email_recipients,sends,opens,clicks,signups,paid_conversions 618ba1ffbe2896088840a6e7,\\"Not so short, bit complex\\",http://127.0.0.1:2369/not-so-short-bit-complex/,Joe Bloggs,published only,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,true,,Public,,,,,0,0 618ba1ffbe2896088840a6e3,Short and Sweet,http://127.0.0.1:2369/short-and-sweet/,Joe Bloggs,published only,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,true,chorizo,Public,,,,,0,0", } @@ -1842,7 +1842,7 @@ 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-disposition": StringMatching /\\^Attachment; filename="post-analytics\\.\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}\\.csv"\\$/, - "content-length": "406", + "content-length": "401", "content-type": "text/csv; charset=utf-8", "content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, @@ -1853,7 +1853,7 @@ Object { exports[`Posts API Export Can export with limit 2 1`] = ` Object { - "text": "id,title,url,author,status,created_at,updated_at,published_at,featured,tags,post_access,email_recipients,sends,opens,clicks,free_signups,paid_conversions + "text": "id,title,url,author,status,created_at,updated_at,published_at,featured,tags,post_access,email_recipients,sends,opens,clicks,signups,paid_conversions 6194d3ce51e2700162531a77,Start here for a quick overview of everything you need to know,http://127.0.0.1:2369/welcome/,Ghost,published only,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,false,Getting Started,Public,,,,,0,0", } `; @@ -1863,7 +1863,7 @@ 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-disposition": StringMatching /\\^Attachment; filename="post-analytics\\.\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}\\.csv"\\$/, - "content-length": "2721", + "content-length": "2716", "content-type": "text/csv; charset=utf-8", "content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/, @@ -1874,7 +1874,7 @@ Object { exports[`Posts API Export Can export with order 2 1`] = ` Object { - "text": "id,title,url,author,status,created_at,updated_at,published_at,featured,tags,post_access,email_recipients,sends,opens,clicks,free_signups,paid_conversions + "text": "id,title,url,author,status,created_at,updated_at,published_at,featured,tags,post_access,email_recipients,sends,opens,clicks,signups,paid_conversions 618ba1ffbe2896088840a6df,HTML Ipsum,http://127.0.0.1:2369/html-ipsum/,Joe Bloggs,published only,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,false,\\"kitchen sink, bacon\\",Public,,,,,0,0 618ba1ffbe2896088840a6e1,Ghostly Kitchen Sink,http://127.0.0.1:2369/ghostly-kitchen-sink/,Joe Bloggs,published only,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,false,\\"kitchen sink, bacon\\",Public,,,,,0,0 618ba1ffbe2896088840a6e3,Short and Sweet,http://127.0.0.1:2369/short-and-sweet/,Joe Bloggs,published only,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,2050-01-01T00:00:00.000Z,true,chorizo,Public,,,,,0,0 diff --git a/ghost/posts-service/lib/PostsExporter.js b/ghost/posts-service/lib/PostsExporter.js index 4b590d97d5..7f8588cf23 100644 --- a/ghost/posts-service/lib/PostsExporter.js +++ b/ghost/posts-service/lib/PostsExporter.js @@ -96,7 +96,7 @@ class PostsExporter { sends: email?.get('email_count') ?? null, opens: trackOpens ? (email?.get('opened_count') ?? null) : null, clicks: showEmailClickAnalytics ? (post.get('count__clicks') ?? 0) : null, - free_signups: membersTrackSources && published ? (post.get('count__signups') ?? 0) : null, + signups: membersTrackSources && published ? (post.get('count__signups') ?? 0) : null, paid_conversions: membersTrackSources && paidMembersEnabled && published ? (post.get('count__paid_conversions') ?? 0) : null, feedback_more_like_this: feedbackEnabled ? (post.get('count__positive_feedback') ?? 0) : null, feedback_less_like_this: feedbackEnabled ? (post.get('count__negative_feedback') ?? 0) : null @@ -126,7 +126,7 @@ class PostsExporter { } if (!membersTrackSources || !membersEnabled) { - removeableColumns.push('free_signups', 'paid_conversions'); + removeableColumns.push('signups', 'paid_conversions'); } else if (!paidMembersEnabled) { removeableColumns.push('paid_conversions'); } diff --git a/ghost/posts-service/test/PostsExporter.test.js b/ghost/posts-service/test/PostsExporter.test.js index 6d54ef2f32..3d69b3a9c9 100644 --- a/ghost/posts-service/test/PostsExporter.test.js +++ b/ghost/posts-service/test/PostsExporter.test.js @@ -190,7 +190,7 @@ describe('PostsExporter', function () { assert.equal(posts[0].newsletter_name, null); // Signups - assert.equal(posts[0].free_signups, null); + assert.equal(posts[0].signups, null); assert.equal(posts[0].paid_conversions, null); }); @@ -209,7 +209,7 @@ describe('PostsExporter', function () { assert.equal(posts[0].clicks, undefined); // Signups - assert.equal(posts[0].free_signups, undefined); + assert.equal(posts[0].signups, undefined); assert.equal(posts[0].paid_conversions, undefined); }); @@ -222,7 +222,7 @@ describe('PostsExporter', function () { assert.notEqual(posts[0].feedback_less_like_this, undefined); assert.notEqual(posts[0].sends, undefined); assert.notEqual(posts[0].opens, undefined); - assert.notEqual(posts[0].free_signups, undefined); + assert.notEqual(posts[0].signups, undefined); assert.notEqual(posts[0].paid_conversions, undefined); assert.equal(posts[0].clicks, undefined); @@ -237,7 +237,7 @@ describe('PostsExporter', function () { assert.notEqual(posts[0].feedback_less_like_this, undefined); assert.notEqual(posts[0].sends, undefined); assert.notEqual(posts[0].clicks, undefined); - assert.notEqual(posts[0].free_signups, undefined); + assert.notEqual(posts[0].signups, undefined); assert.notEqual(posts[0].paid_conversions, undefined); assert.equal(posts[0].opens, undefined); @@ -252,7 +252,7 @@ describe('PostsExporter', function () { assert.notEqual(posts[0].feedback_less_like_this, undefined); assert.notEqual(posts[0].sends, undefined); assert.notEqual(posts[0].clicks, undefined); - assert.notEqual(posts[0].free_signups, undefined); + assert.notEqual(posts[0].signups, undefined); assert.notEqual(posts[0].opens, undefined); assert.equal(posts[0].paid_conversions, undefined); @@ -269,7 +269,7 @@ describe('PostsExporter', function () { assert.equal(posts.length, 1); assert.equal(posts[0].clicks, 0); - assert.equal(posts[0].free_signups, 0); + assert.equal(posts[0].signups, 0); assert.equal(posts[0].paid_conversions, 0); assert.equal(posts[0].feedback_more_like_this, 0); assert.equal(posts[0].feedback_less_like_this, 0);