allow for article_titles
This commit is contained in:
		
							
								
								
									
										1
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| @@ -2271,6 +2271,7 @@ dependencies = [ | |||||||
|  "sqlx", |  "sqlx", | ||||||
|  "tera", |  "tera", | ||||||
|  "ureq", |  "ureq", | ||||||
|  |  "urlencoding", | ||||||
| ] | ] | ||||||
|  |  | ||||||
| [[package]] | [[package]] | ||||||
|   | |||||||
| @@ -28,6 +28,7 @@ itertools = "0.13" | |||||||
| job_scheduler_ng = "2.0" | job_scheduler_ng = "2.0" | ||||||
| ureq = { version = "2.9", features = ["json"] } | ureq = { version = "2.9", features = ["json"] } | ||||||
| regex = "1.10" | regex = "1.10" | ||||||
|  | urlencoding = "2.1" | ||||||
|  |  | ||||||
| [target.'cfg(not(windows))'.dependencies] | [target.'cfg(not(windows))'.dependencies] | ||||||
| openssl = { version = "0.10", features = [ "vendored" ] } | openssl = { version = "0.10", features = [ "vendored" ] } | ||||||
|   | |||||||
| @@ -121,6 +121,7 @@ fn unauthorized_error(req: &Request) -> Redirect { | |||||||
| #[derive(FromForm, Debug)] | #[derive(FromForm, Debug)] | ||||||
| struct NewBlogpostForm<'r> { | struct NewBlogpostForm<'r> { | ||||||
|     article_url: &'r str, |     article_url: &'r str, | ||||||
|  |     article_title: &'r str, | ||||||
|     pw: &'r str, |     pw: &'r str, | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -135,7 +136,7 @@ async fn new_blogpost( | |||||||
|         Notification::create_for_role( |         Notification::create_for_role( | ||||||
|             db, |             db, | ||||||
|             &member, |             &member, | ||||||
|             &format!("auf unserer Website!"), |             &urlencoding::decode(blogpost.article_title).expect("UTF-8"), | ||||||
|             &format!("Neuer Blogpost"), |             &format!("Neuer Blogpost"), | ||||||
|             Some(blogpost.article_url), |             Some(blogpost.article_url), | ||||||
|             None, |             None, | ||||||
|   | |||||||
| @@ -83,6 +83,7 @@ function send_article_url_on_publish($new_status, $old_status, $post) { | |||||||
|     if ($new_status == 'publish' && $old_status != 'publish' && $post->post_type == 'post') { |     if ($new_status == 'publish' && $old_status != 'publish' && $post->post_type == 'post') { | ||||||
|         // Get the URL of the newly published article |         // Get the URL of the newly published article | ||||||
|         $article_url = get_permalink($post->ID); |         $article_url = get_permalink($post->ID); | ||||||
|  |         $article_title = get_the_title($post->ID); | ||||||
|  |  | ||||||
|         // URL to send the GET request to |         // URL to send the GET request to | ||||||
|         $api_url = 'https://staging.rudernlinz.at/new-blogpost'; |         $api_url = 'https://staging.rudernlinz.at/new-blogpost'; | ||||||
| @@ -90,6 +91,7 @@ function send_article_url_on_publish($new_status, $old_status, $post) { | |||||||
|         // Add the article URL as a query parameter |         // Add the article URL as a query parameter | ||||||
|         $request_url = add_query_arg(array( |         $request_url = add_query_arg(array( | ||||||
|             'article_url' => urlencode($article_url), |             'article_url' => urlencode($article_url), | ||||||
|  |             'article_title' => urlencode($article_title), | ||||||
| 	        'pw' => "pw-as-specified-in-rockettoml" | 	        'pw' => "pw-as-specified-in-rockettoml" | ||||||
|         ), $api_url); |         ), $api_url); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user