New groups

This commit is contained in:
2458773093
2019-07-15 16:47:05 +03:00
parent fd50f03304
commit 1fabd28498
30 changed files with 809 additions and 285 deletions

View File

@@ -3,13 +3,27 @@
class REST::GroupSerializer < ActiveModel::Serializer
include RoutingHelper
attributes :id, :title, :description, :cover_image_url, :is_archived
attributes :id, :title, :description, :cover_image_url, :is_archived, :member_count
def id
object.id.to_s
end
def clean_migrated_url
object
.cover_image_file_name
.sub("gab://groups/", "https://gab.com/media/user/")
end
def cover_image_url
if object.cover_image_file_name and object.cover_image_file_name.start_with? "gab://groups/"
return clean_migrated_url
end
full_asset_url(object.cover_image.url)
end
def member_count
object.accounts.count
end
end