From c311f6b9d0cef6fc72e2faaaebef3f8103feef24 Mon Sep 17 00:00:00 2001 From: 2458773093 <2458773093@protonmail.com> Date: Fri, 26 Jul 2019 21:08:51 +0300 Subject: [PATCH] group added to status serialization and old group_id usages changed --- app/javascript/gabsocial/components/status_action_bar.js | 4 ++-- app/models/status.rb | 1 + app/serializers/rest/status_serializer.rb | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/javascript/gabsocial/components/status_action_bar.js b/app/javascript/gabsocial/components/status_action_bar.js index f7ca275f..e65fd689 100644 --- a/app/javascript/gabsocial/components/status_action_bar.js +++ b/app/javascript/gabsocial/components/status_action_bar.js @@ -173,13 +173,13 @@ class StatusActionBar extends ImmutablePureComponent { handleGroupRemoveAccount = () => { const { status } = this.props; - this.props.onGroupRemoveAccount(status.get('group_id'), status.getIn(['account', 'id'])); + this.props.onGroupRemoveAccount(status.getIn(['group', 'id']), status.getIn(['account', 'id'])); } handleGroupRemovePost = () => { const { status } = this.props; - this.props.onGroupRemoveStatus(status.get('group_id'), status.get('id')); + this.props.onGroupRemoveStatus(status.getIn(['group', 'id']), status.get('id')); } _makeMenu = (publicStatus) => { diff --git a/app/models/status.rb b/app/models/status.rb index ce467daf..62c3dc07 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -104,6 +104,7 @@ class Status < ApplicationRecord cache_associated :application, :media_attachments, + :group, :conversation, :status_stat, :tags, diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index 2bd3128f..f94dbca9 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -4,7 +4,7 @@ class REST::StatusSerializer < ActiveModel::Serializer attributes :id, :created_at, :in_reply_to_id, :in_reply_to_account_id, :sensitive, :spoiler_text, :visibility, :language, :uri, :url, :replies_count, :reblogs_count, - :favourites_count, :group_id + :favourites_count attribute :favourited, if: :current_user? attribute :reblogged, if: :current_user? @@ -17,6 +17,7 @@ class REST::StatusSerializer < ActiveModel::Serializer belongs_to :reblog, serializer: REST::StatusSerializer belongs_to :application, if: :show_application? belongs_to :account, serializer: REST::AccountSerializer + belongs_to :group, serializer: REST::GroupSerializer has_many :media_attachments, serializer: REST::MediaAttachmentSerializer has_many :ordered_mentions, key: :mentions