Fix caching bug, and moderation webhook being sent at the wrong time (#215)
This commit is contained in:
parent
d2c2503cfa
commit
981bf1d56f
68
.idea/labrinth.iml
generated
68
.idea/labrinth.iml
generated
@ -76,6 +76,74 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/labrinth-175a4aa21ea52414/out" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/labrinth-175a4aa21ea52414/out" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/proc-macro2-7094aab0eee55116/out" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/proc-macro2-7094aab0eee55116/out" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/sentry-contexts-ca4afd3cc95c36c4/out" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/sentry-contexts-ca4afd3cc95c36c4/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/ahash-fd8ee5b7c1b91d7e/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/async-trait-90a09c9928095b03/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/backtrace-06586d9291523068/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/bitflags-88b50a288ea9b589/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/brotli-sys-48176562eaa37722/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/bzip2-sys-4d892b992243c849/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/const_fn-ea57b975c57c5e0f/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/cookie-6ed23d83ee8e47f9/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/crc-4e3708830692dd8f/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/crc32fast-f112d4af2349618a/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/crossbeam-utils-19816821338f7d1e/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/crossbeam-utils-f18a9a09c842a116/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/curl-657d7509955d72d2/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/curl-sys-761d48e64c74c759/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/encoding_rs-aeb75e3d7246cd68/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/failure_derive-12bd9e50bb08aa4e/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/futures-channel-aaca776527d6f74c/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/futures-core-282be4c3d523964b/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/futures-macro-8bed64c7e4137015/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/futures-task-99072bb77352f68a/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/futures-util-c4d95c11dd859bc2/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/generic-array-d9a21e1c138bc88c/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/getrandom-89e095be090a701c/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/hashbrown-26ee980b09e6675a/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/httparse-16fab0b2d90ac92a/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/indexmap-b9724370d61f58d6/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/isahc-057b5a484e60b032/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/labrinth-14cb10435aa4a1b6/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/lexical-core-5ef649b8d93599c4/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/libc-cf3f1f9dd5a95a85/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/libnghttp2-sys-8190f04f61d0f495/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/libz-sys-90af850d7f9d5980/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/log-a968f45ba0ee21a9/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/maybe-uninit-33854dc1cf68a7c0/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/memchr-e3291fe57535f262/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/mime_guess-f3c3571dd01c3e43/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/miniz_oxide-d683d4a97661215e/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/native-tls-6b9be1dfcaa4ca7a/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/nom-94cf08cdf587b65f/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/nom-987a3bab8c38ef50/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/num-integer-243211f2ff028008/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/num-traits-56cf536a0a30f2f6/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/openssl-94b1f8d2cb407fd2/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/openssl-sys-2a11a8c4b402d6af/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/pin-project-internal-c5c52fd50d774d21/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/proc-macro-error-3767db49a8a5c3f2/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/proc-macro-error-attr-4fdf86427e6e8f90/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/proc-macro-hack-a3cb2722e7116198/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/proc-macro-nested-c16c856e8deac6ce/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/proc-macro2-9fe81105fb85f6f3/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/radium-f58df3ebc129f1a9/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/ring-351030379c4306a2/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/rustversion-824998a0eae3115a/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/ryu-3b42f9ed428b96b3/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/sentry-contexts-a64e54159acab544/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/serde-b1f71e762ff7770a/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/serde_derive-24d0f79641168b3d/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/serde_json-9df943a4e8d2dc0f/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/standback-a5d4da630942a108/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/syn-75b29ddcbee36a3c/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/time-fb34c67db59e12cb/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/tokio-b46abfe7007cdc4e/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/typenum-66964a7887ae2d1b/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/unicase-f608a6d7b236323a/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/v_escape-2204f60f4b37c849/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/v_htmlescape-2dcc3d8195b1decd/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/value-bag-61e3e358d251e1a5/out" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/whoami-7d9ebcbbb2371986/out" isTestSource="false" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
|
|||||||
3
build.rs
3
build.rs
@ -12,8 +12,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn copy<U: AsRef<Path>, V: AsRef<Path>>(from: U, to: V) -> Result<(), std::io::Error> {
|
pub fn copy<U: AsRef<Path>, V: AsRef<Path>>(from: U, to: V) -> Result<(), std::io::Error> {
|
||||||
let mut stack = Vec::new();
|
let mut stack = vec![PathBuf::from(from.as_ref())];
|
||||||
stack.push(PathBuf::from(from.as_ref()));
|
|
||||||
|
|
||||||
let output_root = PathBuf::from(to.as_ref());
|
let output_root = PathBuf::from(to.as_ref());
|
||||||
let input_root = PathBuf::from(from.as_ref()).components().count();
|
let input_root = PathBuf::from(from.as_ref()).components().count();
|
||||||
|
|||||||
@ -19,8 +19,8 @@ impl BackblazeHost {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
BackblazeHost {
|
BackblazeHost {
|
||||||
authorization_data,
|
|
||||||
upload_url_data,
|
upload_url_data,
|
||||||
|
authorization_data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ use crate::models::projects::{
|
|||||||
};
|
};
|
||||||
use crate::models::users::UserId;
|
use crate::models::users::UserId;
|
||||||
use crate::routes::version_creation::InitialVersionData;
|
use crate::routes::version_creation::InitialVersionData;
|
||||||
use crate::search::indexing::{queue::CreationQueue, IndexingError};
|
use crate::search::indexing::IndexingError;
|
||||||
use crate::util::auth::{get_user_from_headers, AuthenticationError};
|
use crate::util::auth::{get_user_from_headers, AuthenticationError};
|
||||||
use crate::util::validate::validation_errors_to_string;
|
use crate::util::validate::validation_errors_to_string;
|
||||||
use actix_multipart::{Field, Multipart};
|
use actix_multipart::{Field, Multipart};
|
||||||
@ -207,7 +207,6 @@ pub async fn project_create(
|
|||||||
payload: Multipart,
|
payload: Multipart,
|
||||||
client: Data<PgPool>,
|
client: Data<PgPool>,
|
||||||
file_host: Data<Arc<dyn FileHost + Send + Sync>>,
|
file_host: Data<Arc<dyn FileHost + Send + Sync>>,
|
||||||
indexing_queue: Data<Arc<CreationQueue>>,
|
|
||||||
) -> Result<HttpResponse, CreateError> {
|
) -> Result<HttpResponse, CreateError> {
|
||||||
let mut transaction = client.begin().await?;
|
let mut transaction = client.begin().await?;
|
||||||
let mut uploaded_files = Vec::new();
|
let mut uploaded_files = Vec::new();
|
||||||
@ -218,7 +217,6 @@ pub async fn project_create(
|
|||||||
&mut transaction,
|
&mut transaction,
|
||||||
&***file_host,
|
&***file_host,
|
||||||
&mut uploaded_files,
|
&mut uploaded_files,
|
||||||
&***indexing_queue,
|
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
@ -275,7 +273,6 @@ pub async fn project_create_inner(
|
|||||||
transaction: &mut sqlx::Transaction<'_, sqlx::Postgres>,
|
transaction: &mut sqlx::Transaction<'_, sqlx::Postgres>,
|
||||||
file_host: &dyn FileHost,
|
file_host: &dyn FileHost,
|
||||||
uploaded_files: &mut Vec<UploadedFile>,
|
uploaded_files: &mut Vec<UploadedFile>,
|
||||||
indexing_queue: &CreationQueue,
|
|
||||||
) -> Result<HttpResponse, CreateError> {
|
) -> Result<HttpResponse, CreateError> {
|
||||||
// The base URL for files uploaded to backblaze
|
// The base URL for files uploaded to backblaze
|
||||||
let cdn_url = dotenv::var("CDN_URL")?;
|
let cdn_url = dotenv::var("CDN_URL")?;
|
||||||
@ -623,14 +620,7 @@ pub async fn project_create_inner(
|
|||||||
|
|
||||||
let _project_id = project_builder.insert(&mut *transaction).await?;
|
let _project_id = project_builder.insert(&mut *transaction).await?;
|
||||||
|
|
||||||
if status.is_searchable() {
|
if status == ProjectStatus::Processing {
|
||||||
let index_project = crate::search::indexing::local_import::query_one(
|
|
||||||
project_id.into(),
|
|
||||||
&mut *transaction,
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
indexing_queue.add(index_project);
|
|
||||||
|
|
||||||
if let Ok(webhook_url) = dotenv::var("MODERATION_DISCORD_WEBHOOK") {
|
if let Ok(webhook_url) = dotenv::var("MODERATION_DISCORD_WEBHOOK") {
|
||||||
crate::util::webhook::send_discord_webhook(response.clone(), webhook_url)
|
crate::util::webhook::send_discord_webhook(response.clone(), webhook_url)
|
||||||
.await
|
.await
|
||||||
|
|||||||
@ -500,6 +500,15 @@ pub async fn project_edit(
|
|||||||
)
|
)
|
||||||
.execute(&mut *transaction)
|
.execute(&mut *transaction)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
if let Ok(webhook_url) = dotenv::var("MODERATION_DISCORD_WEBHOOK") {
|
||||||
|
crate::util::webhook::send_discord_webhook(
|
||||||
|
convert_project(project_item.clone()),
|
||||||
|
webhook_url,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if project_item.status.is_searchable() && !status.is_searchable() {
|
if project_item.status.is_searchable() && !status.is_searchable() {
|
||||||
@ -510,15 +519,6 @@ pub async fn project_edit(
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
indexing_queue.add(index_project);
|
indexing_queue.add(index_project);
|
||||||
|
|
||||||
if let Ok(webhook_url) = dotenv::var("MODERATION_DISCORD_WEBHOOK") {
|
|
||||||
crate::util::webhook::send_discord_webhook(
|
|
||||||
convert_project(project_item.clone()),
|
|
||||||
webhook_url,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
.ok();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,8 +901,14 @@ pub async fn project_edit(
|
|||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_cache_project(string.clone()).await;
|
let id: ProjectId = project_item.inner.id.into();
|
||||||
remove_cache_query_project(string).await;
|
remove_cache_project(id.to_string().clone()).await;
|
||||||
|
remove_cache_query_project(id.to_string()).await;
|
||||||
|
|
||||||
|
if let Some(slug) = project_item.inner.slug {
|
||||||
|
remove_cache_project(slug.clone()).await;
|
||||||
|
remove_cache_query_project(slug).await;
|
||||||
|
}
|
||||||
|
|
||||||
transaction.commit().await?;
|
transaction.commit().await?;
|
||||||
Ok(HttpResponse::NoContent().body(""))
|
Ok(HttpResponse::NoContent().body(""))
|
||||||
@ -1006,8 +1012,14 @@ pub async fn project_icon_edit(
|
|||||||
.execute(&**pool)
|
.execute(&**pool)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
remove_cache_project(string.clone()).await;
|
let id: ProjectId = project_item.id.into();
|
||||||
remove_cache_query_project(string).await;
|
remove_cache_project(id.to_string().clone()).await;
|
||||||
|
remove_cache_query_project(id.to_string()).await;
|
||||||
|
|
||||||
|
if let Some(slug) = project_item.slug {
|
||||||
|
remove_cache_project(slug.clone()).await;
|
||||||
|
remove_cache_query_project(slug).await;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(HttpResponse::NoContent().body(""))
|
Ok(HttpResponse::NoContent().body(""))
|
||||||
} else {
|
} else {
|
||||||
@ -1060,8 +1072,14 @@ pub async fn project_delete(
|
|||||||
|
|
||||||
let result = database::models::Project::remove_full(project.id, &mut transaction).await?;
|
let result = database::models::Project::remove_full(project.id, &mut transaction).await?;
|
||||||
|
|
||||||
remove_cache_project(string.clone()).await;
|
let id: ProjectId = project.id.into();
|
||||||
remove_cache_query_project(string).await;
|
remove_cache_project(id.to_string().clone()).await;
|
||||||
|
remove_cache_query_project(id.to_string()).await;
|
||||||
|
|
||||||
|
if let Some(slug) = project.slug {
|
||||||
|
remove_cache_project(slug.clone()).await;
|
||||||
|
remove_cache_query_project(slug).await;
|
||||||
|
}
|
||||||
|
|
||||||
transaction.commit().await?;
|
transaction.commit().await?;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ use crate::models::projects::SearchRequest;
|
|||||||
use crate::routes::project_creation::{project_create_inner, undo_uploads, CreateError};
|
use crate::routes::project_creation::{project_create_inner, undo_uploads, CreateError};
|
||||||
use crate::routes::projects::{convert_project, ProjectIds};
|
use crate::routes::projects::{convert_project, ProjectIds};
|
||||||
use crate::routes::ApiError;
|
use crate::routes::ApiError;
|
||||||
use crate::search::indexing::queue::CreationQueue;
|
|
||||||
use crate::search::{search_for_project, SearchConfig, SearchError};
|
use crate::search::{search_for_project, SearchConfig, SearchError};
|
||||||
use crate::util::auth::get_user_from_headers;
|
use crate::util::auth::get_user_from_headers;
|
||||||
use crate::{database, models};
|
use crate::{database, models};
|
||||||
@ -139,7 +138,6 @@ pub async fn mod_create(
|
|||||||
payload: Multipart,
|
payload: Multipart,
|
||||||
client: Data<PgPool>,
|
client: Data<PgPool>,
|
||||||
file_host: Data<Arc<dyn FileHost + Send + Sync>>,
|
file_host: Data<Arc<dyn FileHost + Send + Sync>>,
|
||||||
indexing_queue: Data<Arc<CreationQueue>>,
|
|
||||||
) -> Result<HttpResponse, CreateError> {
|
) -> Result<HttpResponse, CreateError> {
|
||||||
let mut transaction = client.begin().await?;
|
let mut transaction = client.begin().await?;
|
||||||
let mut uploaded_files = Vec::new();
|
let mut uploaded_files = Vec::new();
|
||||||
@ -150,7 +148,6 @@ pub async fn mod_create(
|
|||||||
&mut transaction,
|
&mut transaction,
|
||||||
&***file_host,
|
&***file_host,
|
||||||
&mut uploaded_files,
|
&mut uploaded_files,
|
||||||
&***indexing_queue,
|
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
|||||||
@ -34,13 +34,33 @@ pub async fn send_discord_webhook(
|
|||||||
project: Project,
|
project: Project,
|
||||||
webhook_url: String,
|
webhook_url: String,
|
||||||
) -> Result<(), reqwest::Error> {
|
) -> Result<(), reqwest::Error> {
|
||||||
let mut fields = Vec::new();
|
let mut fields = vec![
|
||||||
|
DiscordEmbedField {
|
||||||
fields.push(DiscordEmbedField {
|
|
||||||
name: "id".to_string(),
|
name: "id".to_string(),
|
||||||
value: project.id.to_string(),
|
value: project.id.to_string(),
|
||||||
inline: true,
|
inline: true,
|
||||||
});
|
},
|
||||||
|
DiscordEmbedField {
|
||||||
|
name: "project_type".to_string(),
|
||||||
|
value: project.project_type.to_string(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
DiscordEmbedField {
|
||||||
|
name: "client_side".to_string(),
|
||||||
|
value: project.client_side.to_string(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
DiscordEmbedField {
|
||||||
|
name: "server_side".to_string(),
|
||||||
|
value: project.server_side.to_string(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
DiscordEmbedField {
|
||||||
|
name: "categories".to_string(),
|
||||||
|
value: project.categories.join(", "),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
if let Some(slug) = project.slug.clone() {
|
if let Some(slug) = project.slug.clone() {
|
||||||
fields.push(DiscordEmbedField {
|
fields.push(DiscordEmbedField {
|
||||||
@ -50,30 +70,6 @@ pub async fn send_discord_webhook(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fields.push(DiscordEmbedField {
|
|
||||||
name: "project_type".to_string(),
|
|
||||||
value: project.project_type.to_string(),
|
|
||||||
inline: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
fields.push(DiscordEmbedField {
|
|
||||||
name: "client_side".to_string(),
|
|
||||||
value: project.client_side.to_string(),
|
|
||||||
inline: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
fields.push(DiscordEmbedField {
|
|
||||||
name: "server_side".to_string(),
|
|
||||||
value: project.server_side.to_string(),
|
|
||||||
inline: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
fields.push(DiscordEmbedField {
|
|
||||||
name: "categories".to_string(),
|
|
||||||
value: project.categories.join(", "),
|
|
||||||
inline: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
let embed = DiscordEmbed {
|
let embed = DiscordEmbed {
|
||||||
url: format!(
|
url: format!(
|
||||||
"{}/mod/{}",
|
"{}/mod/{}",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user