-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4157 from thematters/develop
Release: v5.5.1
- Loading branch information
Showing
38 changed files
with
938 additions
and
423 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
db/migrations/20240814222347_alter_draft_add_indent_first_line.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,14 @@ | ||
const table = 'draft' | ||
const newColumn = 'indent_first_line' | ||
|
||
exports.up = async (knex) => { | ||
await knex.schema.alterTable(table, (t) => { | ||
t.boolean(newColumn).notNullable().defaultTo(false) | ||
}) | ||
} | ||
|
||
exports.down = async (knex) => { | ||
await knex.schema.alterTable(table, (t) => { | ||
t.dropColumn(newColumn) | ||
}) | ||
} |
23 changes: 23 additions & 0 deletions
23
db/migrations/20240814222354_alter_article_version_add_indent_first_line.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,23 @@ | ||
const table = 'article_version' | ||
const newColumn = 'indent_first_line' | ||
const view = 'article_version_newest' | ||
|
||
exports.up = async (knex) => { | ||
await knex.schema.alterTable(table, (t) => { | ||
t.boolean(newColumn).notNullable().defaultTo(false) | ||
}) | ||
await knex.raw(/*sql*/ ` | ||
CREATE OR REPLACE VIEW ${view} AS | ||
SELECT a.* | ||
FROM article_version a | ||
LEFT OUTER JOIN article_version b | ||
ON a.article_id= b.article_id AND a.id < b.id | ||
WHERE b.id IS NULL; | ||
`) | ||
} | ||
|
||
exports.down = async (knex) => { | ||
await knex.schema.alterTable(table, (t) => { | ||
t.dropColumn(newColumn) | ||
}) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
import { extractMentionIds } from 'common/utils' | ||
import { extractMentionIds, stripMentions } from 'common/utils' | ||
|
||
test('normalizeQueryInput', async () => { | ||
const content = `<p><a class="mention" href="/@mengxiaobai" data-id="VXNlcjozNzA" data-user-name="mengxiaobai" data-display-name="志澤週" ref="noopener noreferrer nofollow"><span>@志澤週</span></a> test</p>` | ||
expect(extractMentionIds(content)).toEqual(['370']) | ||
}) | ||
|
||
test('strip mentions strips mention', () => { | ||
const content = `<p><a class="mention"><span>@Somebody</span></a> test</p>` | ||
expect(stripMentions(content)).toBe(`<p> test</p>`) | ||
}) | ||
|
||
test('strip mentions strips multiple mentions', () => { | ||
const content = `<p><a class="mention"><span>@foo</span></a><a class="mention"><span>@bar</span></a> test</p>` | ||
expect(stripMentions(content)).toBe(`<p> test</p>`) | ||
}) |
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
Oops, something went wrong.