forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
170 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
ghost/core/test/regression/models/model_collections.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const assert = require('assert/strict'); | ||
const testUtils = require('../../utils'); | ||
const models = require('../../../core/server/models'); | ||
const db = require('../../../core/server/data/db'); | ||
|
||
describe('Collection Model', function () { | ||
before(testUtils.teardownDb); | ||
before(testUtils.stopGhost); | ||
after(testUtils.teardownDb); | ||
|
||
// This is required for the models to be initialised ??? | ||
// @TODO remove this once we have a better way of initialising models | ||
before(testUtils.setup('users:roles', 'posts')); | ||
|
||
describe('add', function () { | ||
it('does not update the sort_order of the collections_posts table', async function () { | ||
if (db?.knex?.client?.config?.client !== 'sqlite3') { | ||
return this.skip(); | ||
} | ||
/** @type {import('sqlite3').Database} */ | ||
const database = db.knex.client; | ||
|
||
let didUpdateCollectionPosts = false; | ||
|
||
function handler(/** @type {{sql: string}} */ query) { | ||
if (query.sql.toLowerCase().includes('update `collections_posts` set `sort_order`')) { | ||
didUpdateCollectionPosts = true; | ||
} | ||
} | ||
|
||
const posts = await models.Post.findAll(); | ||
|
||
database.on('query', handler); | ||
|
||
await models.Collection.add({ | ||
title: 'Test Collection', | ||
slug: 'test-collection', | ||
description: 'Test description', | ||
type: 'manual', | ||
filter: null, | ||
posts: posts.toJSON().map(post => ({id: post.id})), | ||
feature_image: null | ||
}); | ||
|
||
database.off('query', handler); | ||
|
||
const actual = didUpdateCollectionPosts; | ||
const expected = false; | ||
|
||
assert.equal(actual, expected, 'collections_posts should not have been updated'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{{!< default}} | ||
|
||
{{!-- The tag above means: insert everything in this file | ||
into the {body} tag of the default.hbs template --}} | ||
|
||
|
||
{{#post}} | ||
{{!-- Everything inside the #post block pulls data from the page --}} | ||
|
||
<main id="site-main" class="site-main"> | ||
<article class="article {{post_class}}"> | ||
|
||
{{#match @page.show_title_and_feature_image}} | ||
<header class="article-header gh-canvas"> | ||
|
||
<h1 class="article-title">{{title}}</h1> | ||
|
||
{{#if feature_image}} | ||
<figure class="article-image"> | ||
{{!-- This is a responsive image, it loads different sizes depending on device | ||
https://medium.freecodecamp.org/a-guide-to-responsive-images-with-ready-to-use-templates-c400bd65c433 --}} | ||
<img | ||
srcset="{{img_url feature_image size="s"}} 300w, | ||
{{img_url feature_image size="m"}} 600w, | ||
{{img_url feature_image size="l"}} 1000w, | ||
{{img_url feature_image size="xl"}} 2000w" | ||
sizes="(min-width: 1400px) 1400px, 92vw" | ||
src="{{img_url feature_image size="xl"}}" | ||
alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}" | ||
/> | ||
{{#if feature_image_caption}} | ||
<figcaption>{{feature_image_caption}}</figcaption> | ||
{{/if}} | ||
</figure> | ||
{{/if}} | ||
|
||
</header> | ||
{{/match}} | ||
|
||
<section class="gh-content gh-canvas"> | ||
{{content}} | ||
</section> | ||
|
||
</article> | ||
</main> | ||
|
||
{{/post}} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3773,6 +3773,16 @@ | |
"@sentry/utils" "7.60.1" | ||
tslib "^2.4.1 || ^1.9.3" | ||
|
||
"@sentry-internal/[email protected]": | ||
version "7.61.0" | ||
resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.61.0.tgz#5a0dd4a9a0b41f2e22904430f3fe0216f36ee086" | ||
integrity sha512-zTr+MXEG4SxNxif42LIgm2RQn+JRXL2NuGhRaKSD2i4lXKFqHVGlVdoWqY5UfqnnJPokiTWIj9ejR8I5HV8Ogw== | ||
dependencies: | ||
"@sentry/core" "7.61.0" | ||
"@sentry/types" "7.61.0" | ||
"@sentry/utils" "7.61.0" | ||
tslib "^2.4.1 || ^1.9.3" | ||
|
||
"@sentry/[email protected]": | ||
version "7.60.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.60.1.tgz#d11e86f127f3f1b48a7156a4df63ab2b76e534ee" | ||
|
@@ -3794,6 +3804,15 @@ | |
"@sentry/utils" "7.60.1" | ||
tslib "^2.4.1 || ^1.9.3" | ||
|
||
"@sentry/[email protected]": | ||
version "7.61.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.61.0.tgz#0de4f73055bd156c5c0cbac50bb814b272567188" | ||
integrity sha512-zl0ZKRjIoYJQWYTd3K/U6zZfS4GDY9yGd2EH4vuYO4kfYtEp/nJ8A+tfAeDo0c9FGxZ0Q+5t5F4/SfwbgyyQzg== | ||
dependencies: | ||
"@sentry/types" "7.61.0" | ||
"@sentry/utils" "7.61.0" | ||
tslib "^2.4.1 || ^1.9.3" | ||
|
||
"@sentry/[email protected]": | ||
version "7.60.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/ember/-/ember-7.60.1.tgz#e2264df67ebfa5cb26d6cf615605258e630e2dff" | ||
|
@@ -3822,6 +3841,20 @@ | |
lru_map "^0.3.3" | ||
tslib "^2.4.1 || ^1.9.3" | ||
|
||
"@sentry/[email protected]": | ||
version "7.61.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.61.0.tgz#1309330f2ad136af532ad2a03b2a312e885705de" | ||
integrity sha512-oTCqD/h92uvbRCrtCdiAqN6Mfe3vF7ywVHZ8Nq3hHmJp6XadUT+fCBwNQ7rjMyqJAOYAnx/vp6iN9n8C5qcYZQ== | ||
dependencies: | ||
"@sentry-internal/tracing" "7.61.0" | ||
"@sentry/core" "7.61.0" | ||
"@sentry/types" "7.61.0" | ||
"@sentry/utils" "7.61.0" | ||
cookie "^0.4.1" | ||
https-proxy-agent "^5.0.0" | ||
lru_map "^0.3.3" | ||
tslib "^2.4.1 || ^1.9.3" | ||
|
||
"@sentry/[email protected]": | ||
version "7.60.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.60.1.tgz#ceeb35dadebb41454f488c17d0b9c2e5d59e5ff4" | ||
|
@@ -3854,6 +3887,11 @@ | |
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.60.1.tgz#2f8740db56ae4cae87523ae7a0daf753308496f0" | ||
integrity sha512-8lKKSCOhZ953cWxwnfZwoR3ZFFlZG4P3PQFTaFt/u4LxLh/0zYbdtgvtUqXRURjMCi5P6ddeE9Uw9FGnTJCsTw== | ||
|
||
"@sentry/[email protected]": | ||
version "7.61.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.61.0.tgz#4243b5ef4658f6b0673bc4372c90e6ec920f78d8" | ||
integrity sha512-/GLlIBNR35NKPE/SfWi9W10dK9hE8qTShzsuPVn5wAJxpT3Lb4+dkwmKCTLUYxdkmvRDEudkfOxgalsfQGTAWA== | ||
|
||
"@sentry/[email protected]": | ||
version "7.60.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.60.1.tgz#27b20bd2926c877011eb39fcb4b2db95dc72243f" | ||
|
@@ -3862,6 +3900,14 @@ | |
"@sentry/types" "7.60.1" | ||
tslib "^2.4.1 || ^1.9.3" | ||
|
||
"@sentry/[email protected]": | ||
version "7.61.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.61.0.tgz#16944afb2b851af045fb528c0c35b7dea3e1cd3b" | ||
integrity sha512-jfj14d0XBFiCU0G6dZZ12SizATiF5Mt4stBGzkM5iS9nXFj8rh1oTT7/p+aZoYzP2JTF+sDzkNjWxyKZkcTo0Q== | ||
dependencies: | ||
"@sentry/types" "7.61.0" | ||
tslib "^2.4.1 || ^1.9.3" | ||
|
||
"@sidvind/better-ajv-errors@^2.0.0": | ||
version "2.1.0" | ||
resolved "https://registry.yarnpkg.com/@sidvind/better-ajv-errors/-/better-ajv-errors-2.1.0.tgz#54f4216d2200d60e90ec25c6a27c1ea3afdc6cdf" | ||
|
@@ -17180,12 +17226,12 @@ growly@^1.3.0: | |
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" | ||
integrity sha512-+xGQY0YyAWCnqy7Cd++hc2JqMYzlm0dG30Jd0beaA64sROr8C4nt8Yc9V5Ro3avlSUDTN0ulqP/VBKi1/lLygw== | ||
|
||
[email protected].4: | ||
version "4.37.4" | ||
resolved "https://registry.yarnpkg.com/gscan/-/gscan-4.37.4.tgz#d9a05d22f3ad774c947abe8ea2a5af9a69bb3847" | ||
integrity sha512-XI6QazyN9roUJ9kjlwU+qG73XYi8L0mSM0KLm9oLUdhoTFBSHOWUsVVCSu1TJ6z/v0QLmop/dOQYfGinr6bWxg== | ||
[email protected].5: | ||
version "4.37.5" | ||
resolved "https://registry.yarnpkg.com/gscan/-/gscan-4.37.5.tgz#23a640eee2070c1921e32fe70968f727081f4116" | ||
integrity sha512-v0JKMZVZ6AEot39JURnlKyk4VdsHNeQFXz9mnzirV53One1oODfzBCnloj4yiYzreBNlmDL1ve6VRaZ6YX7UtQ== | ||
dependencies: | ||
"@sentry/node" "7.60.1" | ||
"@sentry/node" "7.61.0" | ||
"@tryghost/config" "0.2.17" | ||
"@tryghost/debug" "0.1.25" | ||
"@tryghost/errors" "1.2.25" | ||
|