Skip to content

Commit

Permalink
Merge branch 'mbar' of https://github.com/glitchbirdnew/mastodon into…
Browse files Browse the repository at this point in the history
… mbar
  • Loading branch information
glitchbirdnew committed Oct 2, 2024
2 parents 5fc6c23 + 294acdf commit 83ab11e
Show file tree
Hide file tree
Showing 8 changed files with 688 additions and 24 deletions.
4 changes: 2 additions & 2 deletions app/javascript/mastodon/components/compacted_status.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ class CompactedStatus extends ImmutablePureComponent {
</a>

<a onClick={this.handleAccountClick} href={`/@${status.getIn(['account', 'acct'])}`} title={status.getIn(['account', 'acct'])} data-hover-card-account={status.getIn(['account', 'id'])} className='status__display-name' target='_blank' rel='noopener noreferrer'>
<div className='status__avatar'>
<Avatar account={status.get('account')} size={24} inline />
<div className='status__avatar__compact'>
<Avatar account={status.get('account')} size={32} inline />
</div>

<DisplayName account={status.get('account')} />
Expand Down
8 changes: 6 additions & 2 deletions app/javascript/styles/mastodon/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2316,8 +2316,8 @@ a.account__display-name {
height: 46px;

&.status__avatar__compact {
width: 24px;
height: 24px;
width: 32px;
height: 32px;
}
}

Expand Down Expand Up @@ -11549,4 +11549,8 @@ noscript {
&--compacted-status::after {
display: none;
}

&--compacted-status p {
margin-bottom: 22px;
}
}
7 changes: 4 additions & 3 deletions app/lib/activitypub/parser/status_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def audience_cc
def audience_searchable_by
return nil if @object['searchableBy'].nil?

@audience_searchable_by = as_array(@object['searchableBy']).map { |x| value_or_id(x) }
@audience_searchable_by = as_array(@object['searchableBy']).map { |x| value_or_id(x) }.compact_blank
end

def summary_language_map?
Expand Down Expand Up @@ -204,17 +204,18 @@ def searchability_from_bio

def searchability_from_audience
return nil if audience_searchable_by.blank?
return :limited if audience_searchable_by.include?('kmyblue:Limited') || audience_searchable_by.include?('as:Limited')

if audience_searchable_by.any? { |uri| ActivityPub::TagManager.instance.public_collection?(uri) }
:public
elsif audience_searchable_by.include?('kmyblue:Limited') || audience_searchable_by.include?('as:Limited')
:limited
elsif audience_searchable_by.include?('kmyblue:LocalPublic') && @friend
:public_unlisted
elsif audience_searchable_by.include?(@account.followers_url)
:private
elsif audience_searchable_by.include?(@account.uri) || audience_searchable_by.include?(@account.url)
:direct
else
:limited
end
end
end
10 changes: 6 additions & 4 deletions app/services/activitypub/process_account_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def url
def audience_searchable_by
return nil if @json['searchableBy'].nil?

@audience_searchable_by_processaccountservice = as_array(@json['searchableBy']).map { |x| value_or_id(x) }
@audience_searchable_by_processaccountservice = as_array(@json['searchableBy']).map { |x| value_or_id(x) }.compact_blank
end

def searchability_from_audience
Expand All @@ -289,14 +289,16 @@ def searchability_from_audience
return invalid_subscription_software? ? misskey_searchability_from_indexable : :direct
end

return :limited if audience_searchable_by.include?('kmyblue:Limited') || audience_searchable_by.include?('as:Limited')

if audience_searchable_by.any? { |uri| ActivityPub::TagManager.instance.public_collection?(uri) }
:public
elsif audience_searchable_by.include?(@account.followers_url)
:private
elsif audience_searchable_by.include?('kmyblue:Limited') || audience_searchable_by.include?('as:Limited')
:limited
else
elsif audience_searchable_by.include?(@account.uri) || audience_searchable_by.include?(@account.url)
:direct
else
:limited
end
end

Expand Down
5 changes: 0 additions & 5 deletions app/views/settings/preferences/notifications/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,3 @@
label_method: ->(setting) { I18n.t("simple_form.labels.notification_emails.software_updates.#{setting}") },
label: I18n.t('simple_form.labels.notification_emails.software_updates.label'),
wrapper: :with_label

- if Setting.enable_emoji_reaction
= f.simple_fields_for :settings, current_user.settings do |ff|
.fields-group
= ff.input :stop_emoji_reaction_streaming, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_stop_emoji_reaction_streaming'), hint: I18n.t('simple_form.hints.defaults.setting_stop_emoji_reaction_streaming')
4 changes: 4 additions & 0 deletions app/views/settings/preferences/other/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
label: I18n.t('simple_form.labels.defaults.setting_default_sensitive'),
wrapper: :with_label

- if Setting.enable_emoji_reaction
.fields-group
= ff.input :stop_emoji_reaction_streaming, as: :boolean, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_stop_emoji_reaction_streaming'), hint: I18n.t('simple_form.hints.defaults.setting_stop_emoji_reaction_streaming')

- if @dtl_enabled

%h4= t 'preferences.dtl'
Expand Down
16 changes: 8 additions & 8 deletions spec/lib/activitypub/activity/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -653,30 +653,30 @@ def activity_for_object(json)
end
end

context 'with direct when not specify' do
let(:searchable_by) { nil }
context 'with unintended value' do
let(:searchable_by) { 'ohagi' }

it 'create status' do
status = sender.statuses.first

expect(status).to_not be_nil
expect(status.searchability).to be_nil
expect(status.searchability).to eq 'limited'
end
end

context 'with limited' do
let(:searchable_by) { 'kmyblue:Limited' }
context 'with direct when not specify' do
let(:searchable_by) { nil }

it 'create status' do
status = sender.statuses.first

expect(status).to_not be_nil
expect(status.searchability).to eq 'limited'
expect(status.searchability).to be_nil
end
end

context 'with limited old spec' do
let(:searchable_by) { 'as:Limited' }
context 'with limited' do
let(:searchable_by) { 'kmyblue:Limited' }

it 'create status' do
status = sender.statuses.first
Expand Down
Loading

0 comments on commit 83ab11e

Please sign in to comment.