a5ae957ac5
• Updated: - GroupInfoPanel to be markdown enabled, linkable for users, hashtags, urls
39 lines
868 B
Ruby
39 lines
868 B
Ruby
# frozen_string_literal: true
|
|
|
|
class REST::GroupSerializer < ActiveModel::Serializer
|
|
include RoutingHelper
|
|
|
|
attributes :id, :title, :description, :description_html, :cover_image_url, :is_archived,
|
|
:member_count, :created_at, :is_private, :is_visible, :slug, :tags, :category
|
|
|
|
def id
|
|
object.id.to_s
|
|
end
|
|
|
|
def category
|
|
object.group_categories_id
|
|
end
|
|
|
|
def description
|
|
object.description
|
|
end
|
|
|
|
def description_html
|
|
Formatter.instance.formatGroupDescription(object.description).strip
|
|
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
|
|
end
|