jsonvalue-fix

This commit is contained in:
2023-10-16 19:40:45 +03:00
parent c9650772bc
commit a84bf61e4e
3 changed files with 6 additions and 5 deletions

View File

@@ -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))