🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@chillenberger
Copy link
Contributor

@chillenberger chillenberger commented Jun 14, 2024

  • add product High banner to all of product
  • add product High Modal popup
  • add product Medium banner to product with deployment specific capability
  • add product Marketing banner to all of product
  • add review after duration

@chillenberger chillenberger marked this pull request as ready for review June 14, 2024 17:37
@chillenberger chillenberger merged commit d1c7351 into master Jun 14, 2024
@chillenberger chillenberger deleted the dan-product-notifications branch June 14, 2024 17:43
pub fn update_viewed(new: &Vec<String>, cookies: &CookieJar<'_>) {
let mut cookie = Cookie::new("session", format!(r#"{{"notifications": {:?}}}"#, new));
pub fn update_viewed(new: &Vec<NotificationCookie>, cookies: &CookieJar<'_>) {
let serialized = new.iter().map(|x| x.to_string()).collect::<Vec<String>>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to use serde_json::to_string


impl std::fmt::Display for NotificationCookie {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut rsp = format!(r#"{{"id": "{}""#, self.id.clone());
Copy link
Contributor

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
}

pub fn json(body: String) -> Response {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move this to pgml_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())
Copy link
Contributor

@levkk levkk Jun 14, 2024

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.

chillenberger added a commit that referenced this pull request Jun 17, 2024
@chillenberger chillenberger restored the dan-product-notifications branch June 17, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants