image: alpine:3
commands:
- apk add curl
- - "curl -d'Drone build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
+ - "curl -d'Lemmy CI build failed: ${CI_BUILD_LINK}' ntfy.sh/lemmy_drone_ci"
when:
status: [failure]
/// The response for a site.
pub struct SiteResponse {
pub site_view: SiteView,
+ pub taglines: Vec<Tagline>,
}
#[skip_serializing_none]
local_site::{LocalSite, LocalSiteUpdateForm},
local_site_rate_limit::{LocalSiteRateLimit, LocalSiteRateLimitUpdateForm},
site::{Site, SiteUpdateForm},
+ tagline::Tagline,
},
traits::Crud,
utils::{diesel_option_overwrite, diesel_option_overwrite_to_url, naive_now},
let site_view = SiteView::read_local(context.pool()).await?;
+ let new_taglines = data.taglines.clone();
+ let taglines = Tagline::replace(context.pool(), local_site.id, new_taglines).await?;
+
let rate_limit_config =
local_site_rate_limit_to_rate_limit_config(&site_view.local_site_rate_limit);
context
.send(rate_limit_config)
.await?;
- Ok(SiteResponse { site_view })
+ Ok(SiteResponse {
+ site_view,
+ taglines,
+ })
}
}
.map_err(|e| LemmyError::from_error_message(e, "couldnt_set_all_email_verified"))?;
}
- let taglines = data.taglines.clone();
- Tagline::replace(context.pool(), local_site.id, taglines).await?;
+ let new_taglines = data.taglines.clone();
+ let taglines = Tagline::replace(context.pool(), local_site.id, new_taglines).await?;
let site_view = SiteView::read_local(context.pool()).await?;
.send(rate_limit_config)
.await?;
- let res = SiteResponse { site_view };
+ let res = SiteResponse {
+ site_view,
+ taglines,
+ };
context.send_all_ws_message(&UserOperationCrud::EditSite, &res, websocket_id)?;
pool: &DbPool,
for_local_site_id: LocalSiteId,
list_content: Option<Vec<String>>,
- ) -> Result<(), Error> {
+ ) -> Result<Vec<Self>, Error> {
+ let conn = &mut get_conn(pool).await?;
if let Some(list) = list_content {
- let conn = &mut get_conn(pool).await?;
conn
.build_transaction()
.run(|conn| {
.get_result::<Self>(conn)
.await?;
}
- Ok(())
+ Self::get_all_conn(conn, for_local_site_id).await
}) as _
})
.await
} else {
- Ok(())
+ Self::get_all_conn(conn, for_local_site_id).await
}
}
async fn clear(conn: &mut AsyncPgConnection) -> Result<usize, Error> {
diesel::delete(tagline).execute(conn).await
}
- pub async fn get_all(pool: &DbPool, for_local_site_id: LocalSiteId) -> Result<Vec<Self>, Error> {
- let conn = &mut get_conn(pool).await?;
+
+ async fn get_all_conn(
+ conn: &mut AsyncPgConnection,
+ for_local_site_id: LocalSiteId,
+ ) -> Result<Vec<Self>, Error> {
tagline
.filter(local_site_id.eq(for_local_site_id))
.get_results::<Self>(conn)
.await
}
+ pub async fn get_all(pool: &DbPool, for_local_site_id: LocalSiteId) -> Result<Vec<Self>, Error> {
+ let conn = &mut get_conn(pool).await?;
+ Self::get_all_conn(conn, for_local_site_id).await
+ }
}