Added has_quote to status_serializer and set in status.rb
• Added: - has_quote to status_serializer and set in status.rb
This commit is contained in:
parent
bc54a281e6
commit
32c62955bf
@ -27,6 +27,7 @@
|
|||||||
# revised_at :datetime
|
# revised_at :datetime
|
||||||
# markdown :text
|
# markdown :text
|
||||||
# expires_at :datetime
|
# expires_at :datetime
|
||||||
|
# has_quote :boolean
|
||||||
#
|
#
|
||||||
|
|
||||||
class Status < ApplicationRecord
|
class Status < ApplicationRecord
|
||||||
@ -278,6 +279,7 @@ class Status < ApplicationRecord
|
|||||||
before_validation :set_reblog
|
before_validation :set_reblog
|
||||||
before_validation :set_visibility
|
before_validation :set_visibility
|
||||||
before_validation :set_conversation
|
before_validation :set_conversation
|
||||||
|
before_validation :set_has_quote
|
||||||
before_validation :set_group_id
|
before_validation :set_group_id
|
||||||
before_validation :set_local
|
before_validation :set_local
|
||||||
|
|
||||||
@ -515,6 +517,10 @@ class Status < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_has_quote
|
||||||
|
self.has_quote = !quote_of_id.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def carried_over_reply_to_account_id
|
def carried_over_reply_to_account_id
|
||||||
if thread.account_id == account_id && thread.reply?
|
if thread.account_id == account_id && thread.reply?
|
||||||
thread.in_reply_to_account_id
|
thread.in_reply_to_account_id
|
||||||
|
@ -4,7 +4,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||||||
attributes :id, :created_at, :revised_at, :in_reply_to_id, :in_reply_to_account_id,
|
attributes :id, :created_at, :revised_at, :in_reply_to_id, :in_reply_to_account_id,
|
||||||
:sensitive, :spoiler_text, :visibility, :language,
|
:sensitive, :spoiler_text, :visibility, :language,
|
||||||
:uri, :url, :replies_count, :reblogs_count,
|
:uri, :url, :replies_count, :reblogs_count,
|
||||||
:favourites_count, :quote_of_id, :expires_at
|
:favourites_count, :quote_of_id, :expires_at, :has_quote
|
||||||
|
|
||||||
attribute :favourited, if: :current_user?
|
attribute :favourited, if: :current_user?
|
||||||
attribute :reblogged, if: :current_user?
|
attribute :reblogged, if: :current_user?
|
||||||
|
Loading…
Reference in New Issue
Block a user