fix: show published big fish works in gallery
Some checks failed
CI / verify (push) Has been cancelled
Some checks failed
CI / verify (push) Has been cancelled
This commit is contained in:
@@ -77,8 +77,12 @@ fn start_big_fish_run_tx(
|
||||
.big_fish_creation_session()
|
||||
.session_id()
|
||||
.find(&input.session_id)
|
||||
.filter(|row| row.owner_user_id == input.owner_user_id)
|
||||
.ok_or_else(|| "big_fish_creation_session 不存在".to_string())?;
|
||||
if session.owner_user_id != input.owner_user_id
|
||||
&& session.stage != BigFishCreationStage::Published
|
||||
{
|
||||
return Err("big_fish_creation_session 不存在".to_string());
|
||||
}
|
||||
let draft = session
|
||||
.draft_json
|
||||
.as_deref()
|
||||
@@ -124,8 +128,12 @@ fn submit_big_fish_input_tx(
|
||||
.big_fish_creation_session()
|
||||
.session_id()
|
||||
.find(&run.session_id)
|
||||
.filter(|row| row.owner_user_id == input.owner_user_id)
|
||||
.ok_or_else(|| "big_fish_creation_session 不存在".to_string())?;
|
||||
if session.owner_user_id != input.owner_user_id
|
||||
&& session.stage != BigFishCreationStage::Published
|
||||
{
|
||||
return Err("big_fish_creation_session 不存在".to_string());
|
||||
}
|
||||
let draft = session
|
||||
.draft_json
|
||||
.as_deref()
|
||||
|
||||
@@ -239,6 +239,10 @@ pub(crate) fn list_big_fish_works_tx(
|
||||
.big_fish_creation_session()
|
||||
.iter()
|
||||
.filter(|row| {
|
||||
if input.published_only {
|
||||
return row.stage == BigFishCreationStage::Published;
|
||||
}
|
||||
|
||||
row.owner_user_id == input.owner_user_id && should_include_big_fish_work(ctx, row)
|
||||
})
|
||||
.map(|row| build_big_fish_work_summary(ctx, &row))
|
||||
@@ -330,6 +334,7 @@ pub(crate) fn delete_big_fish_work_tx(
|
||||
ctx,
|
||||
BigFishWorksListInput {
|
||||
owner_user_id: input.owner_user_id,
|
||||
published_only: false,
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -642,6 +647,7 @@ pub(crate) fn build_big_fish_work_summary(
|
||||
Ok(BigFishWorkSummarySnapshot {
|
||||
work_id: format!("big-fish-work-{}", row.session_id),
|
||||
source_session_id: row.session_id.clone(),
|
||||
owner_user_id: row.owner_user_id.clone(),
|
||||
title,
|
||||
subtitle,
|
||||
summary,
|
||||
|
||||
Reference in New Issue
Block a user