Add show user block api endpoint
This commit is contained in:
parent
0e21afc565
commit
71654e563e
6 changed files with 66 additions and 0 deletions
14
app/views/api/user_blocks/_user_block.xml.builder
Normal file
14
app/views/api/user_blocks/_user_block.xml.builder
Normal file
|
@ -0,0 +1,14 @@
|
|||
attrs = {
|
||||
"id" => user_block.id,
|
||||
"created_at" => user_block.created_at.xmlschema,
|
||||
"updated_at" => user_block.updated_at.xmlschema,
|
||||
"ends_at" => user_block.ends_at.xmlschema,
|
||||
"needs_view" => user_block.needs_view
|
||||
}
|
||||
|
||||
xml.user_block(attrs) do
|
||||
xml.user :uid => user_block.user_id, :user => user_block.user.display_name
|
||||
xml.creator :uid => user_block.creator_id, :user => user_block.creator.display_name
|
||||
xml.revoker :uid => user_block.revoker_id, :user => user_block.revoker.display_name if user_block.revoker
|
||||
xml.reason user_block.reason
|
||||
end
|
5
app/views/api/user_blocks/show.xml.builder
Normal file
5
app/views/api/user_blocks/show.xml.builder
Normal file
|
@ -0,0 +1,5 @@
|
|||
xml.instruct!
|
||||
|
||||
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
|
||||
osm << (render(@user_block) || "")
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue