Progress
This commit is contained in:
@@ -31,6 +31,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
||||
store[:unread_count] = unread_count object.current_account
|
||||
store[:last_read_notification_id] = object.current_account.user.last_read_notification
|
||||
store[:monthly_expenses_complete] = Redis.current.get("monthly_funding_amount") || 0
|
||||
store[:trending_hashtags] = get_trending_hashtags
|
||||
store[:is_first_session] = is_first_session object.current_account
|
||||
store[:email_confirmed] = object.current_account.user.confirmed?
|
||||
store[:email] = object.current_account.user.confirmed? ? '[hidden]' : object.current_account.user.email
|
||||
@@ -39,6 +40,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
||||
store
|
||||
end
|
||||
|
||||
|
||||
def compose
|
||||
store = {}
|
||||
|
||||
@@ -78,4 +80,9 @@ class InitialStateSerializer < ActiveModel::Serializer
|
||||
object.current_account.user.sign_in_count === 1
|
||||
end
|
||||
|
||||
def get_trending_hashtags
|
||||
tags = Redis.current.get("admin_trending_hashtags") || ""
|
||||
return tags.strip.split(", ")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class REST::AccountSerializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
|
||||
attributes :id, :username, :acct, :display_name, :locked, :bot, :created_at,
|
||||
:note, :url, :avatar, :avatar_static, :header, :header_static,
|
||||
:note, :url, :avatar, :avatar_static, :header, :header_static, :is_flagged_as_spam,
|
||||
:followers_count, :following_count, :statuses_count, :is_pro, :is_verified, :is_donor, :is_investor
|
||||
|
||||
has_one :moved_to_account, key: :moved, serializer: REST::AccountSerializer, if: :moved_and_not_nested?
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::ChatConversationAccountSerializer < ActiveModel::Serializer
|
||||
attributes :id, :is_hidden, :is_approved, :unread_count, :is_unread, :chat_conversation_id, :created_at
|
||||
attributes :id, :is_hidden, :is_approved, :unread_count,
|
||||
:is_unread, :chat_conversation_id, :created_at,
|
||||
:is_blocked, :is_muted, :chat_message_expiration_policy
|
||||
|
||||
has_many :participant_accounts, key: :other_accounts, serializer: REST::AccountSerializer
|
||||
has_one :last_chat_message, serializer: REST::ChatMessageSerializer, unless: :last_chat_message_id?
|
||||
@@ -22,4 +24,12 @@ class REST::ChatConversationAccountSerializer < ActiveModel::Serializer
|
||||
object.unread_count > 0
|
||||
end
|
||||
|
||||
def is_blocked
|
||||
false
|
||||
end
|
||||
|
||||
def is_muted
|
||||
false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
class REST::ChatMessageSerializer < ActiveModel::Serializer
|
||||
attributes :id, :text_html, :text, :language, :from_account_id,
|
||||
:chat_conversation_id, :created_at
|
||||
:chat_conversation_id, :created_at, :expires_at
|
||||
|
||||
def id
|
||||
object.id.to_s
|
||||
|
||||
Reference in New Issue
Block a user