Merge branch 'master' of github.com:Plume-org/Plume
This commit is contained in:
		
						commit
						b7aa1790e5
					
				| @ -248,6 +248,21 @@ impl Blog { | |||||||
|             } |             } | ||||||
|         }) |         }) | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     pub fn get_fqn(&self, conn: &PgConnection) -> String { | ||||||
|  |         if self.instance_id == Instance::local_id(conn) { | ||||||
|  |             self.actor_id.clone() | ||||||
|  |         } else { | ||||||
|  |             format!("{}@{}", self.actor_id, self.get_instance(conn).public_domain) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     pub fn to_json(&self, conn: &PgConnection) -> serde_json::Value { | ||||||
|  |         let mut json = serde_json::to_value(self).unwrap(); | ||||||
|  |         let formatted = serde_json::Value::String(format!("/~/{}",self.get_fqn(conn))); | ||||||
|  |         json["fqn"] = formatted; | ||||||
|  |         json | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl IntoId for Blog { | impl IntoId for Blog { | ||||||
|  | |||||||
| @ -202,11 +202,13 @@ impl Post { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pub fn to_json(&self, conn: &PgConnection) -> serde_json::Value { |     pub fn to_json(&self, conn: &PgConnection) -> serde_json::Value { | ||||||
|  |         let blog = self.get_blog(conn); | ||||||
|         json!({ |         json!({ | ||||||
|             "post": self, |             "post": self, | ||||||
|             "author": self.get_authors(conn)[0].to_json(conn), |             "author": self.get_authors(conn)[0].to_json(conn), | ||||||
|             "url": format!("/~/{}/{}/", self.get_blog(conn).actor_id, self.slug), |             "url": format!("/~/{}/{}/", blog.actor_id, self.slug), | ||||||
|             "date": self.creation_date.timestamp() |             "date": self.creation_date.timestamp(), | ||||||
|  |             "blog": blog.to_json(conn) | ||||||
|         }) |         }) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ | |||||||
|                 link_4="</a>") |                 link_4="</a>") | ||||||
|             }} |             }} | ||||||
|             ⋅ {{ article.date | date(format="%B %e") }} |             ⋅ {{ article.date | date(format="%B %e") }} | ||||||
|  |             ⋅ <a href="{{ article.blog.fqn }}">{{ article.blog.title }}</a> | ||||||
|         </p> |         </p> | ||||||
|     </div> |     </div> | ||||||
| {% endmacro post_card %} | {% endmacro post_card %} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user