Content-Length: 388615 | pFad | https://github.com/postgresml/postgresml/pull/1524

ED Dan product notifications by chillenberger · Pull Request #1524 · postgresml/postgresml · GitHub
Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 14, 2024
Merged

Dan product notifications #1524

merged 13 commits into from
Jun 14, 2024

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
1 check passed
@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.

Some(session) => {
match serde_json::from_str::<serde_json::Value>(session.value()).unwrap()["notifications"].as_array() {
Some(items) => items
.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.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/postgresml/postgresml/pull/1524

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy