jsonvalue-fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION, CONTENT_TYPE};
|
||||
use reqwest::Client as HTTPClient;
|
||||
use serde_json::json;
|
||||
use serde_json::{json, Value};
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::error::Error;
|
||||
@@ -106,12 +106,12 @@ async fn get_shout_followers(shout_id: &str) -> Result<Vec<i32>, Box<dyn Error>>
|
||||
pub async fn is_fitting(
|
||||
listener_id: i32,
|
||||
kind: String,
|
||||
payload: HashMap<String, String>,
|
||||
payload: HashMap<String, Value>,
|
||||
) -> Result<bool, &'static str> {
|
||||
match &kind[0..9] {
|
||||
"new_react" => {
|
||||
// payload is Reaction, kind is new_reaction<reaction_kind>
|
||||
let shout_id = payload.get("shout").unwrap();
|
||||
let shout_id = payload.get("shout").unwrap().as_str().unwrap();
|
||||
let recipients = get_shout_followers(shout_id).await.unwrap();
|
||||
|
||||
Ok(recipients.contains(&listener_id))
|
||||
|
Reference in New Issue
Block a user