Bump version to 6.1
This commit is contained in:
commit
e9a18c7b1a
9 changed files with 88 additions and 55 deletions
|
@ -44,7 +44,7 @@ class Api::V1::StatusesController < Api::BaseController
|
|||
|
||||
ancestors_results = @status.in_reply_to_id.nil? ? [] : @status.ancestors(ancestors_limit, current_account)
|
||||
descendants_results = @status.descendants(descendants_limit, current_account, descendants_depth_limit)
|
||||
references_results = @status.references
|
||||
references_results = @status.readable_references(current_account)
|
||||
loaded_ancestors = cache_collection(ancestors_results, Status)
|
||||
loaded_descendants = cache_collection(descendants_results, Status)
|
||||
loaded_references = cache_collection(references_results, Status)
|
||||
|
|
31
app/helpers/kmyblue_capabilities_helper.rb
Normal file
31
app/helpers/kmyblue_capabilities_helper.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module KmyblueCapabilitiesHelper
|
||||
def fedibird_capabilities
|
||||
capabilities = [
|
||||
:enable_wide_emoji,
|
||||
:kmyblue_searchability,
|
||||
:searchability,
|
||||
:kmyblue_markdown,
|
||||
:kmyblue_reaction_deck,
|
||||
:kmyblue_visibility_login,
|
||||
:status_reference,
|
||||
:visibility_mutual,
|
||||
:visibility_limited,
|
||||
:kmyblue_limited_scope,
|
||||
:kmyblue_antenna,
|
||||
:kmyblue_bookmark_category,
|
||||
:kmyblue_quote,
|
||||
:kmyblue_searchability_limited,
|
||||
:kmyblue_visibility_public_unlisted,
|
||||
]
|
||||
|
||||
capabilities << :profile_search unless Chewy.enabled?
|
||||
if Setting.enable_emoji_reaction
|
||||
capabilities << :emoji_reaction
|
||||
capabilities << :enable_wide_emoji_reaction
|
||||
end
|
||||
|
||||
capabilities
|
||||
end
|
||||
end
|
|
@ -11,6 +11,15 @@ module StatusThreadingConcern
|
|||
find_statuses_from_tree_path(descendant_ids(limit, depth), account, promote: true)
|
||||
end
|
||||
|
||||
def readable_references(account = nil)
|
||||
statuses = references.to_a
|
||||
account_ids = statuses.map(&:account_id).uniq
|
||||
domains = statuses.filter_map(&:account_domain).uniq
|
||||
relations = account&.relations_map(account_ids, domains) || {}
|
||||
statuses.reject! { |status| StatusFilter.new(status, account, relations).filtered? }
|
||||
statuses
|
||||
end
|
||||
|
||||
def self_replies(limit)
|
||||
account.statuses.where(in_reply_to_id: id, visibility: [:public, :unlisted, :public_unlisted, :login]).reorder(id: :asc).limit(limit)
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
class NodeInfo::Serializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
include KmyblueCapabilitiesHelper
|
||||
|
||||
attributes :version, :software, :protocols, :services, :usage, :open_registrations, :metadata
|
||||
|
||||
|
@ -38,7 +39,9 @@ class NodeInfo::Serializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def metadata
|
||||
{}
|
||||
{
|
||||
features: fedibird_capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -8,6 +8,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
include RoutingHelper
|
||||
include KmyblueCapabilitiesHelper
|
||||
|
||||
attributes :domain, :title, :version, :source_url, :description,
|
||||
:usage, :thumbnail, :languages, :configuration,
|
||||
|
@ -105,31 +106,6 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
}
|
||||
end
|
||||
|
||||
# for third party apps
|
||||
def fedibird_capabilities
|
||||
capabilities = [
|
||||
:enable_wide_emoji,
|
||||
:enable_wide_emoji_reaction,
|
||||
:kmyblue_searchability,
|
||||
:searchability,
|
||||
:kmyblue_markdown,
|
||||
:kmyblue_reaction_deck,
|
||||
:kmyblue_visibility_login,
|
||||
:status_reference,
|
||||
:visibility_mutual,
|
||||
:visibility_limited,
|
||||
:kmyblue_limited_scope,
|
||||
:kmyblue_antenna,
|
||||
:kmyblue_bookmark_category,
|
||||
]
|
||||
|
||||
capabilities << :profile_search unless Chewy.enabled?
|
||||
capabilities << :emoji_reaction if Setting.enable_emoji_reaction
|
||||
capabilities << :kmyblue_visibility_public_unlisted if Setting.enable_public_unlisted_visibility
|
||||
|
||||
capabilities
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def registrations_enabled?
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
class REST::V1::InstanceSerializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
include KmyblueCapabilitiesHelper
|
||||
|
||||
attributes :uri, :title, :short_description, :description, :email,
|
||||
:version, :urls, :stats, :thumbnail,
|
||||
|
@ -114,31 +115,6 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
|
|||
UserRole.everyone.can?(:invite_users)
|
||||
end
|
||||
|
||||
# for third party apps
|
||||
def fedibird_capabilities
|
||||
capabilities = [
|
||||
:enable_wide_emoji,
|
||||
:enable_wide_emoji_reaction,
|
||||
:kmyblue_searchability,
|
||||
:searchability,
|
||||
:kmyblue_markdown,
|
||||
:kmyblue_reaction_deck,
|
||||
:kmyblue_visibility_login,
|
||||
:status_reference,
|
||||
:visibility_mutual,
|
||||
:visibility_limited,
|
||||
:kmyblue_limited_scope,
|
||||
:kmyblue_antenna,
|
||||
:kmyblue_bookmark_category,
|
||||
]
|
||||
|
||||
capabilities << :profile_search unless Chewy.enabled?
|
||||
capabilities << :emoji_reaction if Setting.enable_emoji_reaction
|
||||
capabilities << :kmyblue_visibility_public_unlisted if Setting.enable_public_unlisted_visibility
|
||||
|
||||
capabilities
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def instance_presenter
|
||||
|
|
|
@ -9,7 +9,7 @@ module Mastodon
|
|||
end
|
||||
|
||||
def kmyblue_minor
|
||||
0
|
||||
1
|
||||
end
|
||||
|
||||
def kmyblue_flag
|
||||
|
@ -25,11 +25,11 @@ module Mastodon
|
|||
end
|
||||
|
||||
def patch
|
||||
1
|
||||
0
|
||||
end
|
||||
|
||||
def default_prerelease
|
||||
'rc1'
|
||||
''
|
||||
end
|
||||
|
||||
def prerelease
|
||||
|
|
32
spec/serializers/nodeinfo/serializer_spec.rb
Normal file
32
spec/serializers/nodeinfo/serializer_spec.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe NodeInfo::Serializer do # rubocop:disable RSpec/FilePath
|
||||
let(:serialization) do
|
||||
JSON.parse(
|
||||
ActiveModelSerializers::SerializableResource.new(
|
||||
record, adapter: NodeInfo::Adapter, serializer: described_class, root: 'nodeinfo'
|
||||
).to_json
|
||||
)
|
||||
end
|
||||
let(:record) { {} }
|
||||
|
||||
describe 'nodeinfo version' do
|
||||
it 'returns 2.0' do
|
||||
expect(serialization['version']).to eq '2.0'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'mastodon version' do
|
||||
it 'contains kmyblue' do
|
||||
expect(serialization['software']['version'].include?('kmyblue')).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe 'metadata' do
|
||||
it 'returns features' do
|
||||
expect(serialization['metadata']['features']).to include 'emoji_reaction'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -17,4 +17,10 @@ describe REST::InstanceSerializer do
|
|||
expect(serialization['usage']).to eq({ 'users' => { 'active_month' => 0 } })
|
||||
end
|
||||
end
|
||||
|
||||
describe 'fedibird_capabilities' do
|
||||
it 'returns fedibird_capabilities' do
|
||||
expect(serialization['fedibird_capabilities']).to include 'emoji_reaction'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue