mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
refactor: Fix errors in api/client/tag.rs
This commit is contained in:
+6
-12
@@ -27,9 +27,7 @@ pub(crate) async fn update_tag_route(
|
|||||||
.account_data
|
.account_data
|
||||||
.get_room(&body.room_id, sender_user, RoomAccountDataEventType::Tag)
|
.get_room(&body.room_id, sender_user, RoomAccountDataEventType::Tag)
|
||||||
.await
|
.await
|
||||||
.unwrap_or(TagEvent {
|
.unwrap_or(TagEvent::new(TagEventContent::new(BTreeMap::new())));
|
||||||
content: TagEventContent { tags: BTreeMap::new() },
|
|
||||||
});
|
|
||||||
|
|
||||||
tags_event
|
tags_event
|
||||||
.content
|
.content
|
||||||
@@ -46,7 +44,7 @@ pub(crate) async fn update_tag_route(
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(create_tag::v3::Response {})
|
Ok(create_tag::v3::Response::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `DELETE /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}`
|
/// # `DELETE /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}`
|
||||||
@@ -64,9 +62,7 @@ pub(crate) async fn delete_tag_route(
|
|||||||
.account_data
|
.account_data
|
||||||
.get_room(&body.room_id, sender_user, RoomAccountDataEventType::Tag)
|
.get_room(&body.room_id, sender_user, RoomAccountDataEventType::Tag)
|
||||||
.await
|
.await
|
||||||
.unwrap_or(TagEvent {
|
.unwrap_or(TagEvent::new(TagEventContent::new(BTreeMap::new())));
|
||||||
content: TagEventContent { tags: BTreeMap::new() },
|
|
||||||
});
|
|
||||||
|
|
||||||
tags_event.content.tags.remove(&body.tag.clone().into());
|
tags_event.content.tags.remove(&body.tag.clone().into());
|
||||||
|
|
||||||
@@ -80,7 +76,7 @@ pub(crate) async fn delete_tag_route(
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(delete_tag::v3::Response {})
|
Ok(delete_tag::v3::Response::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags`
|
/// # `GET /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags`
|
||||||
@@ -98,9 +94,7 @@ pub(crate) async fn get_tags_route(
|
|||||||
.account_data
|
.account_data
|
||||||
.get_room(&body.room_id, sender_user, RoomAccountDataEventType::Tag)
|
.get_room(&body.room_id, sender_user, RoomAccountDataEventType::Tag)
|
||||||
.await
|
.await
|
||||||
.unwrap_or(TagEvent {
|
.unwrap_or(TagEvent::new(TagEventContent::new(BTreeMap::new())));
|
||||||
content: TagEventContent { tags: BTreeMap::new() },
|
|
||||||
});
|
|
||||||
|
|
||||||
Ok(get_tags::v3::Response { tags: tags_event.content.tags })
|
Ok(get_tags::v3::Response::new(tags_event.content.tags))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user