include_author xml, stream_entry.target
else
object_type xml, stream_entry.target.object_type
+ verb xml, stream_entry.target.verb
title xml, stream_entry.target.title
link_alternate xml, TagManager.instance.url_for(stream_entry.target)
end
target_account
end
- def object_type
- :person
- end
-
def hidden?
true
end
destroyed? ? "#{account.acct} no longer favourites a status by #{status.account.acct}" : "#{account.acct} favourited a status by #{status.account.acct}"
end
- delegate :object_type, to: :target
-
def thread
status
end
target_account
end
- def object_type
- :person
- end
-
def title
destroyed? ? "#{account.acct} is no longer following #{target_account.acct}" : "#{account.acct} started following #{target_account.acct}"
end
validates :account_id, uniqueness: { scope: :target_account_id }
def authorize!
- @verb = :authorize
+ @verb = :authorize
+ @target = clone.freeze
account.follow!(target_account)
MergeWorker.perform_async(target_account.id, account.id)
end
def reject!
- @verb = :reject
+ @verb = :reject
+ @target = clone.freeze
+
destroy!
end
end
def target
- target_account
- end
-
- def object_type
- :person
+ if destroyed? && @verb
+ @target
+ else
+ target_account
+ end
end
def hidden?
belongs_to :account, inverse_of: :stream_entries
belongs_to :activity, polymorphic: true
- belongs_to :status, foreign_type: 'Status', foreign_key: 'activity_id'
- belongs_to :follow, foreign_type: 'Follow', foreign_key: 'activity_id'
- belongs_to :favourite, foreign_type: 'Favourite', foreign_key: 'activity_id'
- belongs_to :block, foreign_type: 'Block', foreign_key: 'activity_id'
+ belongs_to :status, foreign_type: 'Status', foreign_key: 'activity_id'
+ belongs_to :follow, foreign_type: 'Follow', foreign_key: 'activity_id'
+ belongs_to :favourite, foreign_type: 'Favourite', foreign_key: 'activity_id'
+ belongs_to :block, foreign_type: 'Block', foreign_key: 'activity_id'
+ belongs_to :follow_request, foreign_type: 'FollowRequest', foreign_key: 'activity_id'
validates :account, :activity, presence: true
end
def targeted?
- [:follow, :request_friend, :authorize, :unfollow, :block, :unblock, :share, :favorite].include? verb
+ [:follow, :request_friend, :authorize, :reject, :unfollow, :block, :unblock, :share, :favorite].include? verb
end
def target
end
def activity
- !new_record? ? send(activity_type.downcase) : super
+ !new_record? ? send(activity_type.underscore) : super
end
private
Accounts can be "private" or "public". The former requires a follow request to be approved before a follow relationship can be established, the latter can be followed directly.
-Statuses can be "private", "unlisted" or "public". Private must only be shown to the followers of the account, public can be displayed publicly. Unlisted statuses may be displayed publicly but preferably outside of any spotlights e.g. "whole known network" or "public" timelines.
+Statuses can be "private", "unlisted" or "public". Private must only be shown to the followers of the account or people mentioned in the status; public can be displayed publicly. Unlisted statuses may be displayed publicly but preferably outside of any spotlights e.g. "whole known network" or "public" timelines.
Namespace of the scope element is `http://mastodon.social/schema/1.0`. Example:
- `http://activitystrea.ms/schema/1.0/authorize`
- `http://activitystrea.ms/schema/1.0/reject`
-The activity object of the slaps is the account in question. Request-friend slap is sent to that account, when the end-user of that account decides, the authorize/reject decision slap is sent back to the requester.
+The activity object of the request-friend slap is the account in question. The activity object of the authorize and reject slaps is the original request-friend activity. Request-friend slap is sent to the locked account, when the end-user of that account decides, the authorize/reject decision slap is sent back to the requester.
#### PuSH amendment
end
describe '#object_type' do
- it 'is a note when the target is a note' do
- expect(subject.object_type).to be :note
- end
-
- it 'is a comment when the target is a comment' do
- status.in_reply_to_id = 2
- expect(subject.object_type).to be :comment
+ it 'is an activity' do
+ expect(subject.object_type).to be :activity
end
end
end
describe '#object_type' do
- it 'is a person' do
- expect(subject.object_type).to be :person
+ it 'is an activity' do
+ expect(subject.object_type).to be :activity
end
end