Allow tag property value to be an object
This commit is contained in:
parent
c2fe43356f
commit
24303f00d0
2 changed files with 5 additions and 3 deletions
|
@ -82,7 +82,7 @@ pub struct Object {
|
||||||
pub quote_url: Option<String>,
|
pub quote_url: Option<String>,
|
||||||
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub tag: Option<Vec<Tag>>,
|
pub tag: Option<Value>,
|
||||||
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub to: Option<Value>,
|
pub to: Option<Value>,
|
||||||
|
|
|
@ -6,7 +6,7 @@ use tokio_postgres::GenericClient;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::activitypub::{
|
use crate::activitypub::{
|
||||||
activity::{Attachment, Link, Object},
|
activity::{Attachment, Link, Object, Tag},
|
||||||
constants::AP_PUBLIC,
|
constants::AP_PUBLIC,
|
||||||
fetcher::fetchers::fetch_file,
|
fetcher::fetchers::fetch_file,
|
||||||
fetcher::helpers::{
|
fetcher::helpers::{
|
||||||
|
@ -197,7 +197,9 @@ pub async fn handle_note(
|
||||||
let mut mentions: Vec<Uuid> = Vec::new();
|
let mut mentions: Vec<Uuid> = Vec::new();
|
||||||
let mut tags = vec![];
|
let mut tags = vec![];
|
||||||
let mut links = vec![];
|
let mut links = vec![];
|
||||||
if let Some(list) = object.tag {
|
if let Some(value) = object.tag {
|
||||||
|
let list: Vec<Tag> = parse_property_value(&value)
|
||||||
|
.map_err(|_| ValidationError("invalid tag property"))?;
|
||||||
for tag in list {
|
for tag in list {
|
||||||
if tag.tag_type == HASHTAG {
|
if tag.tag_type == HASHTAG {
|
||||||
if let Some(tag_name) = tag.name {
|
if let Some(tag_name) = tag.name {
|
||||||
|
|
Loading…
Reference in a new issue