- Notifications
You must be signed in to change notification settings - Fork352
Dan product notifications#1524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| pubfnupdate_viewed(new:&Vec<String>,cookies:&CookieJar<'_>){ | ||
| letmut cookie =Cookie::new("session",format!(r#"{{"notifications": {:?}}}"#, new)); | ||
| pubfnupdate_viewed(new:&Vec<NotificationCookie>,cookies:&CookieJar<'_>){ | ||
| let serialized = new.iter().map(|x| x.to_string()).collect::<Vec<String>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You want to useserde_json::to_string
| impl std::fmt::DisplayforNotificationCookie{ | ||
| fnfmt(&self,f:&mut std::fmt::Formatter<'_>) -> std::fmt::Result{ | ||
| letmut rsp =format!(r#"{{"id": "{}""#,self.id.clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
serde_json::to_string
| self | ||
| } | ||
| pubfnjson(body:String) ->Response{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We should move this topgml_components crate.
| .into_iter() | ||
| .map(|x|x.as_str().unwrap().to_string()) | ||
| .collect::<Vec<String>>(), | ||
| .map(|x|serde_json::from_str::<NotificationCookie>(&x.to_string()).unwrap()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is not backwards compatible. You need to catch the deserialization error here and either bubble up the error, convert the old format to the new one, or return a default value.
This reverts commitd1c7351.
Uh oh!
There was an error while loading.Please reload this page.