mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 00:26:30 +00:00
Expose nonAnonymous field from Smithereen polls
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
e3ea311cd5
commit
93370b870a
3 changed files with 15 additions and 2 deletions
|
@ -29,6 +29,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do
|
|||
|
||||
field(:closed, ObjectValidators.DateTime)
|
||||
field(:voters, {:array, ObjectValidators.ObjectID}, default: [])
|
||||
field(:nonAnonymous, :boolean)
|
||||
embeds_many(:anyOf, QuestionOptionsValidator)
|
||||
embeds_many(:oneOf, QuestionOptionsValidator)
|
||||
end
|
||||
|
|
|
@ -56,6 +56,12 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
|
|||
}
|
||||
},
|
||||
description: "Possible answers for the poll."
|
||||
},
|
||||
pleroma: %Schema{
|
||||
type: :object,
|
||||
properties: %{
|
||||
non_anonymous: %Schema{type: :boolean, description: "Is the voters collection public?"}
|
||||
}
|
||||
}
|
||||
},
|
||||
example: %{
|
||||
|
@ -79,7 +85,10 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
|
|||
votes_count: 4
|
||||
}
|
||||
],
|
||||
emojis: []
|
||||
emojis: [],
|
||||
pleroma: %{
|
||||
non_anonymous: false
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
|
|
@ -21,7 +21,10 @@ defmodule Pleroma.Web.MastodonAPI.PollView do
|
|||
votes_count: votes_count,
|
||||
voters_count: voters_count(object),
|
||||
options: options,
|
||||
emojis: Pleroma.Web.MastodonAPI.StatusView.build_emojis(object.data["emoji"])
|
||||
emojis: Pleroma.Web.MastodonAPI.StatusView.build_emojis(object.data["emoji"]),
|
||||
pleroma: %{
|
||||
non_anonymous: object.data["nonAnonymous"] || false
|
||||
}
|
||||
}
|
||||
|
||||
if params[:for] do
|
||||
|
|
Loading…
Reference in a new issue