Skip to content

Commit c0aa1ca

Browse files
committed
Merge branch 'release/v1.1.0'
2 parents b72d0ae + 8a91754 commit c0aa1ca

23 files changed

Lines changed: 255 additions & 49 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [[1.1.0]](https://github.com/thoth-pub/thoth/releases/tag/v1.1.0) - 2026-04-17
10+
### Added
11+
- [745](https://github.com/thoth-pub/thoth/pull/745) - Add Venda locale support for titles/books with `ve` and `ve-ZA`
12+
- [745](https://github.com/thoth-pub/thoth/pull/745) - Implement markup support for series description
13+
914
## [[1.0.5]](https://github.com/thoth-pub/thoth/releases/tag/v1.0.5) - 2026-04-15
1015
### Added
1116
- Add `workStatuses` filtering to `subjects` and `subjectCount` queries

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth"
3-
version = "1.0.5"
3+
version = "1.1.0"
44
authors = ["Javier Arias <javi@thoth.pub>", "Ross Higman <ross@thoth.pub>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -15,10 +15,10 @@ maintenance = { status = "actively-developed" }
1515
members = ["thoth-api", "thoth-api-server", "thoth-client", "thoth-errors", "thoth-export-server"]
1616

1717
[dependencies]
18-
thoth-api = { version = "=1.0.5", path = "thoth-api", features = ["backend"] }
19-
thoth-api-server = { version = "=1.0.5", path = "thoth-api-server" }
20-
thoth-errors = { version = "=1.0.5", path = "thoth-errors" }
21-
thoth-export-server = { version = "=1.0.5", path = "thoth-export-server" }
18+
thoth-api = { version = "=1.1.0", path = "thoth-api", features = ["backend"] }
19+
thoth-api-server = { version = "=1.1.0", path = "thoth-api-server" }
20+
thoth-errors = { version = "=1.1.0", path = "thoth-errors" }
21+
thoth-export-server = { version = "=1.1.0", path = "thoth-export-server" }
2222
base64 = "0.22.1"
2323
clap = { version = "4.5.32", features = ["cargo", "env"] }
2424
dialoguer = { version = "0.11.0", features = ["password"] }

thoth-api-server/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api-server"
3-
version = "1.0.5"
3+
version = "1.1.0"
44
authors = ["Javier Arias <javi@thoth.pub>", "Ross Higman <ross@thoth.pub>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth"
99
readme = "README.md"
1010

1111
[dependencies]
12-
thoth-api = { version = "=1.0.5", path = "../thoth-api", features = ["backend"] }
13-
thoth-errors = { version = "=1.0.5", path = "../thoth-errors" }
12+
thoth-api = { version = "=1.1.0", path = "../thoth-api", features = ["backend"] }
13+
thoth-errors = { version = "=1.1.0", path = "../thoth-errors" }
1414
actix-web = "4.10"
1515
actix-cors = "0.7.1"
1616
actix-http = "3.10.0"

thoth-api/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thoth-api"
3-
version = "1.0.5"
3+
version = "1.1.0"
44
authors = ["Javier Arias <javi@thoth.pub>", "Ross Higman <ross@thoth.pub>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -31,7 +31,7 @@ backend = [
3131
]
3232

3333
[dependencies]
34-
thoth-errors = { version = "=1.0.5", path = "../thoth-errors" }
34+
thoth-errors = { version = "=1.1.0", path = "../thoth-errors" }
3535
actix-web = { version = "4.10", optional = true }
3636
isbn = "0.6.0"
3737
chrono = { version = "0.4.40", features = ["serde"] }
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
DO $$
2+
BEGIN
3+
IF EXISTS (
4+
SELECT
5+
1
6+
FROM
7+
(
8+
SELECT
9+
locale_code::text AS locale_code
10+
FROM
11+
public.abstract
12+
UNION ALL
13+
SELECT
14+
locale_code::text
15+
FROM
16+
public.biography
17+
UNION ALL
18+
SELECT
19+
default_locale::text
20+
FROM
21+
public.imprint
22+
WHERE
23+
default_locale IS NOT NULL
24+
UNION ALL
25+
SELECT
26+
locale_code::text
27+
FROM
28+
public.title
29+
) AS locale_codes
30+
WHERE
31+
locale_code IN ('ve', 've_za')
32+
) THEN
33+
RAISE EXCEPTION 'Cannot revert locale_code enum while ve/ve_za values are in use.';
34+
END IF;
35+
END
36+
$$;
37+
38+
ALTER TYPE public.locale_code
39+
RENAME TO locale_code_old;
40+
41+
DO $$
42+
DECLARE
43+
locale_enum_labels TEXT;
44+
BEGIN
45+
SELECT
46+
string_agg(quote_literal(enumlabel), ', ' ORDER BY enumsortorder)
47+
INTO locale_enum_labels
48+
FROM
49+
pg_enum
50+
WHERE
51+
enumtypid = 'public.locale_code_old'::regtype
52+
AND enumlabel NOT IN ('ve', 've_za');
53+
54+
EXECUTE 'CREATE TYPE public.locale_code AS ENUM (' || locale_enum_labels || ')';
55+
END
56+
$$;
57+
58+
ALTER TABLE public.abstract
59+
ALTER COLUMN locale_code TYPE public.locale_code
60+
USING locale_code::text::public.locale_code;
61+
62+
ALTER TABLE public.biography
63+
ALTER COLUMN locale_code TYPE public.locale_code
64+
USING locale_code::text::public.locale_code;
65+
66+
ALTER TABLE public.imprint
67+
ALTER COLUMN default_locale TYPE public.locale_code
68+
USING default_locale::text::public.locale_code;
69+
70+
ALTER TABLE public.title
71+
ALTER COLUMN locale_code TYPE public.locale_code
72+
USING locale_code::text::public.locale_code;
73+
74+
DROP TYPE public.locale_code_old;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TYPE public.locale_code
2+
ADD VALUE IF NOT EXISTS 've' BEFORE 'vi';
3+
4+
ALTER TYPE public.locale_code
5+
ADD VALUE IF NOT EXISTS 've_za' BEFORE 'vi';

thoth-api/src/graphql/model.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,8 +1718,25 @@ impl Series {
17181718
}
17191719

17201720
#[graphql(description = "Description of the series")]
1721-
pub fn series_description(&self) -> Option<&String> {
1722-
self.series_description.as_ref()
1721+
pub fn series_description(
1722+
&self,
1723+
#[graphql(
1724+
default = MarkupFormat::JatsXml,
1725+
description = "Markup format used for rendering series description",
1726+
)]
1727+
markup_format: Option<MarkupFormat>,
1728+
) -> FieldResult<Option<String>> {
1729+
self.series_description
1730+
.as_ref()
1731+
.map(|series_description| {
1732+
convert_from_jats(
1733+
series_description,
1734+
markup_format.ok_or(ThothError::MissingMarkupFormat)?,
1735+
ConversionLimit::Abstract,
1736+
)
1737+
})
1738+
.transpose()
1739+
.map_err(Into::into)
17231740
}
17241741

17251742
#[graphql(description = "URL of the series' call for proposals page")]

thoth-api/src/graphql/mutation.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,20 @@ impl MutationRoot {
117117
#[graphql(description = "Create a new series with the specified values")]
118118
fn create_series(
119119
context: &Context,
120-
#[graphql(description = "Values for series to be created")] data: NewSeries,
120+
#[graphql(description = "The markup format of the series description")]
121+
markup_format: Option<MarkupFormat>,
122+
#[graphql(description = "Values for series to be created")] mut data: NewSeries,
121123
) -> FieldResult<Series> {
122124
SeriesPolicy::can_create(context, &data, ())?;
125+
126+
let markup = markup_format.unwrap_or(MarkupFormat::JatsXml);
127+
data.series_description = data
128+
.series_description
129+
.map(|series_description| {
130+
convert_to_jats(series_description, markup, ConversionLimit::Abstract)
131+
})
132+
.transpose()?;
133+
123134
Series::create(&context.db, &data).map_err(Into::into)
124135
}
125136

@@ -466,11 +477,21 @@ impl MutationRoot {
466477
#[graphql(description = "Update an existing series with the specified values")]
467478
fn update_series(
468479
context: &Context,
469-
#[graphql(description = "Values to apply to existing series")] data: PatchSeries,
480+
#[graphql(description = "The markup format of the series description")]
481+
markup_format: Option<MarkupFormat>,
482+
#[graphql(description = "Values to apply to existing series")] mut data: PatchSeries,
470483
) -> FieldResult<Series> {
471484
let series = context.load_current(&data.series_id)?;
472485
SeriesPolicy::can_update(context, &series, &data, ())?;
473486

487+
let markup = markup_format.unwrap_or(MarkupFormat::JatsXml);
488+
data.series_description = data
489+
.series_description
490+
.map(|series_description| {
491+
convert_to_jats(series_description, markup, ConversionLimit::Abstract)
492+
})
493+
.transpose()?;
494+
474495
series.update(context, &data).map_err(Into::into)
475496
}
476497

thoth-api/src/graphql/tests.rs

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,8 +1509,11 @@ fn assert_series_resolvers(series: &Series, context: &Context) {
15091509
assert_eq!(series.issn_digital(), series.issn_digital.as_ref());
15101510
assert_eq!(series.series_url(), series.series_url.as_ref());
15111511
assert_eq!(
1512-
series.series_description(),
1513-
series.series_description.as_ref()
1512+
series
1513+
.series_description(Some(MarkupFormat::JatsXml))
1514+
.unwrap()
1515+
.as_ref(),
1516+
series.series_description.as_ref(),
15141517
);
15151518
assert_eq!(series.series_cfp_url(), series.series_cfp_url.as_ref());
15161519
assert_eq!(series.imprint_id(), series.imprint_id);
@@ -2369,6 +2372,80 @@ fn graphql_award_supports_role_prize_statement_and_new_fields() {
23692372
.contains("<bold>"));
23702373
}
23712374

2375+
#[test]
2376+
fn graphql_series_description_supports_markup_roundtrip() {
2377+
let (_guard, pool) = test_db::setup_test_db();
2378+
let schema = create_schema();
2379+
let superuser = test_db::test_superuser("user-series-markup");
2380+
let context = test_db::test_context_with_user(pool.clone(), superuser);
2381+
let seed = seed_data(&schema, &context);
2382+
2383+
let series = create_with_data_and_markup(
2384+
&schema,
2385+
&context,
2386+
"createSeries",
2387+
"NewSeries",
2388+
"seriesId seriesDescription(markupFormat: PLAIN_TEXT)",
2389+
NewSeries {
2390+
series_type: SeriesType::Journal,
2391+
series_name: unique("Series"),
2392+
issn_print: None,
2393+
issn_digital: None,
2394+
series_url: Some("https://example.com/series".to_string()),
2395+
series_description: Some("**Initial** description".to_string()),
2396+
series_cfp_url: Some("https://example.com/cfp".to_string()),
2397+
imprint_id: seed.imprint_id,
2398+
},
2399+
MarkupFormat::Markdown,
2400+
);
2401+
2402+
assert_eq!(
2403+
series["seriesDescription"].as_str(),
2404+
Some("Initial description")
2405+
);
2406+
2407+
let series_id = json_uuid(&series["seriesId"]);
2408+
let stored = Series::from_id(pool.as_ref(), &series_id).expect("Failed to fetch series");
2409+
assert!(stored
2410+
.series_description
2411+
.as_deref()
2412+
.unwrap_or_default()
2413+
.contains("<bold>"));
2414+
2415+
let updated = update_with_data_and_markup(
2416+
&schema,
2417+
&context,
2418+
"updateSeries",
2419+
"PatchSeries",
2420+
"seriesId seriesDescription(markupFormat: PLAIN_TEXT)",
2421+
PatchSeries {
2422+
series_id,
2423+
series_type: stored.series_type,
2424+
series_name: stored.series_name.clone(),
2425+
issn_print: stored.issn_print.clone(),
2426+
issn_digital: stored.issn_digital.clone(),
2427+
series_url: stored.series_url.clone(),
2428+
series_description: Some("_Updated_ description".to_string()),
2429+
series_cfp_url: stored.series_cfp_url.clone(),
2430+
imprint_id: stored.imprint_id,
2431+
},
2432+
MarkupFormat::Markdown,
2433+
);
2434+
2435+
assert_eq!(
2436+
updated["seriesDescription"].as_str(),
2437+
Some("Updated description")
2438+
);
2439+
2440+
let updated_stored =
2441+
Series::from_id(pool.as_ref(), &series_id).expect("Failed to fetch series");
2442+
assert!(updated_stored
2443+
.series_description
2444+
.as_deref()
2445+
.unwrap_or_default()
2446+
.contains("<italic>"));
2447+
}
2448+
23722449
#[test]
23732450
fn graphql_additional_resource_exposes_date() {
23742451
let (_guard, pool) = test_db::setup_test_db();

0 commit comments

Comments
 (0)