-}
-
-#[derive(Clone, Debug, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-pub struct Vote {
- pub(in crate::activities::voting) to: PublicUrl,
- pub(in crate::activities::voting) object: Url,
- pub(in crate::activities::voting) cc: [Url; 1],
- #[serde(rename = "type")]
- pub(in crate::activities::voting) kind: VoteType,
- #[serde(flatten)]
- pub(in crate::activities::voting) common: ActivityCommonFields,
-}
-
-impl Vote {
- pub async fn send(
- object: &PostOrComment,
- actor: &Person,
- community_id: CommunityId,
- kind: VoteType,
- context: &LemmyContext,
- ) -> Result<(), LemmyError> {
- let community = blocking(context.pool(), move |conn| {
- Community::read(conn, community_id)
- })
- .await??;
- let id = generate_activity_id(kind.clone())?;