Add API modifiers to limit returned toots from public/hashtag timelines
to only those from local users; Add link to "extended information" to getting started in the UI; Add defaults for posting privacy; Change how publish button looks depending on posting privacy chosen
This commit is contained in:
parent
4d2be9f432
commit
347a153b3d
15 changed files with 55 additions and 34 deletions
|
@ -102,21 +102,25 @@ class Status < ApplicationRecord
|
|||
where(account: [account] + account.following)
|
||||
end
|
||||
|
||||
def as_public_timeline(account = nil)
|
||||
def as_public_timeline(account = nil, local_only = false)
|
||||
query = joins('LEFT OUTER JOIN accounts ON statuses.account_id = accounts.id')
|
||||
.where(visibility: :public)
|
||||
.where('(statuses.in_reply_to_id IS NULL OR statuses.in_reply_to_account_id = statuses.account_id)')
|
||||
.where('statuses.reblog_of_id IS NULL')
|
||||
|
||||
query = query.where('accounts.domain IS NULL') if local_only
|
||||
|
||||
account.nil? ? filter_timeline_default(query) : filter_timeline_default(filter_timeline(query, account))
|
||||
end
|
||||
|
||||
def as_tag_timeline(tag, account = nil)
|
||||
def as_tag_timeline(tag, account = nil, local_only = false)
|
||||
query = tag.statuses
|
||||
.joins('LEFT OUTER JOIN accounts ON statuses.account_id = accounts.id')
|
||||
.where(visibility: :public)
|
||||
.where('statuses.reblog_of_id IS NULL')
|
||||
|
||||
query = query.where('accounts.domain IS NULL') if local_only
|
||||
|
||||
account.nil? ? filter_timeline_default(query) : filter_timeline_default(filter_timeline(query, account))
|
||||
end
|
||||
|
||||
|
|
|
@ -21,4 +21,8 @@ class User < ApplicationRecord
|
|||
def send_devise_notification(notification, *args)
|
||||
devise_mailer.send(notification, self, *args).deliver_later
|
||||
end
|
||||
|
||||
def setting_default_privacy
|
||||
settings.default_privacy || (account.locked? ? 'private' : 'public')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue