Skip to content

Commit

Permalink
Merge branch 'kb_development' into kbtopic-6-friend-server
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Oct 7, 2023
2 parents 069bb0e + 583f5fe commit 311827a
Show file tree
Hide file tree
Showing 76 changed files with 1,470 additions and 829 deletions.
4 changes: 0 additions & 4 deletions .bundler-audit.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
# Ignore Vagrant files
.vagrant/

# Ignore Capistrano customizations
/config/deploy/*

# Ignore IDE files
.vscode/
.idea/
Expand Down
3 changes: 0 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
# Ignore Vagrant files
.vagrant/

# Ignore Capistrano customizations
/config/deploy/*

# Ignore IDE files
.vscode/
.idea/
Expand Down
15 changes: 0 additions & 15 deletions Capfile

This file was deleted.

6 changes: 0 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,6 @@ group :development do
# Linter CLI for HAML files
gem 'haml_lint', require: false

# Deployment automation
gem 'capistrano', '~> 3.17'
gem 'capistrano-rails', '~> 1.6'
gem 'capistrano-rbenv', '~> 2.2'
gem 'capistrano-yarn', '~> 2.0'

# Validate missing i18n keys
gem 'i18n-tasks', '~> 1.0', require: false
end
Expand Down
35 changes: 4 additions & 31 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ GEM
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_serializers (0.10.13)
actionpack (>= 4.1, < 7.1)
activemodel (>= 4.1, < 7.1)
active_model_serializers (0.10.14)
actionpack (>= 4.1)
activemodel (>= 4.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (7.0.8)
Expand All @@ -112,8 +112,6 @@ GEM
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
aes_key_wrap (1.1.0)
airbrussh (1.4.1)
sshkit (>= 1.6.1, != 1.7.0)
android_key_attestation (0.3.0)
annotate (3.2.0)
activerecord (>= 3.2, < 8.0)
Expand Down Expand Up @@ -175,21 +173,6 @@ GEM
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
thor (~> 1.0)
capistrano (3.17.3)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.1.0)
capistrano (~> 3.1)
capistrano-rails (1.6.3)
capistrano (~> 3.1)
capistrano-bundler (>= 1.1, < 3)
capistrano-rbenv (2.2.0)
capistrano (~> 3.1)
sshkit (~> 1.3)
capistrano-yarn (2.0.2)
capistrano (~> 3.0)
capybara (3.39.2)
addressable
matrix
Expand Down Expand Up @@ -473,11 +456,8 @@ GEM
net-protocol
net-protocol (0.2.1)
timeout
net-scp (4.0.0)
net-ssh (>= 2.6.5, < 8.0.0)
net-smtp (0.3.3)
net-protocol
net-ssh (7.1.0)
nio4r (2.5.9)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
Expand Down Expand Up @@ -693,7 +673,7 @@ GEM
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_range (3.0.0)
sidekiq (6.5.9)
sidekiq (6.5.10)
connection_pool (>= 2.2.5, < 3)
rack (~> 2.0)
redis (>= 4.5.0, < 5)
Expand Down Expand Up @@ -728,9 +708,6 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sshkit (1.21.5)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stackprof (0.2.25)
statsd-ruby (1.5.0)
stoplight (3.0.2)
Expand Down Expand Up @@ -831,10 +808,6 @@ DEPENDENCIES
brakeman (~> 6.0)
browser
bundler-audit (~> 0.9)
capistrano (~> 3.17)
capistrano-rails (~> 1.6)
capistrano-rbenv (~> 2.2)
capistrano-yarn (~> 2.0)
capybara (~> 3.39)
charlock_holmes (~> 0.7.7)
chewy (~> 7.3)
Expand Down
10 changes: 6 additions & 4 deletions app/controllers/concerns/web_app_controller_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ module WebAppControllerConcern
extend ActiveSupport::Concern

included do
prepend_before_action :redirect_unauthenticated_to_permalinks!
before_action :set_app_body_class

vary_by 'Accept, Accept-Language, Cookie'

before_action :redirect_unauthenticated_to_permalinks!
before_action :set_app_body_class
end

def skip_csrf_meta_tags?
Expand All @@ -22,7 +22,9 @@ def redirect_unauthenticated_to_permalinks!
return if user_signed_in? && current_account.moved_to_account_id.nil?

redirect_path = PermalinkRedirector.new(request.path).redirect_path
return if redirect_path.blank?

redirect_to(redirect_path) if redirect_path.present?
expires_in(15.seconds, public: true, stale_while_revalidate: 30.seconds, stale_if_error: 1.day) unless user_signed_in?
redirect_to(redirect_path)
end
end
1 change: 0 additions & 1 deletion app/controllers/follower_accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
class FollowerAccountsController < ApplicationController
include AccountControllerConcern
include SignatureVerification
include WebAppControllerConcern

vary_by -> { public_fetch_mode? ? 'Accept, Accept-Language, Cookie' : 'Accept, Accept-Language, Cookie, Signature' }

Expand Down
1 change: 0 additions & 1 deletion app/controllers/following_accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
class FollowingAccountsController < ApplicationController
include AccountControllerConcern
include SignatureVerification
include WebAppControllerConcern

vary_by -> { public_fetch_mode? ? 'Accept, Accept-Language, Cookie' : 'Accept, Accept-Language, Cookie, Signature' }

Expand Down
32 changes: 32 additions & 0 deletions app/helpers/kmyblue_capabilities_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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_searchability_public_unlisted,
]

capabilities << :profile_search unless Chewy.enabled?
if Setting.enable_emoji_reaction
capabilities << :emoji_reaction
capabilities << :enable_wide_emoji_reaction
end
capabilities << :kmyblue_visibility_public_unlisted if Setting.enable_public_unlisted_visibility

capabilities
end
end
18 changes: 18 additions & 0 deletions app/helpers/languages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,24 @@ module LanguagesHelper
'sr-Latn': 'Srpski (latinica)',
}.freeze

# Helper for self.sorted_locale_keys
private_class_method def self.locale_name_for_sorting(locale)
if locale.blank? || locale == 'und'
'000'
elsif (supported_locale = SUPPORTED_LOCALES[locale.to_sym])
ASCIIFolding.new.fold(supported_locale[1]).downcase
elsif (regional_locale = REGIONAL_LOCALE_NAMES[locale.to_sym])
ASCIIFolding.new.fold(regional_locale).downcase
else
locale
end
end

# Sort locales by native name for dropdown menus
def self.sorted_locale_keys(locale_keys)
locale_keys.sort_by { |key, _| locale_name_for_sorting(key) }
end

def native_locale_name(locale)
if locale.blank? || locale == 'und'
I18n.t('generic.none')
Expand Down
6 changes: 5 additions & 1 deletion app/helpers/settings_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

module SettingsHelper
def filterable_languages
LanguagesHelper::SUPPORTED_LOCALES.keys
LanguagesHelper.sorted_locale_keys(LanguagesHelper::SUPPORTED_LOCALES.keys)
end

def ui_languages
LanguagesHelper.sorted_locale_keys(I18n.available_locales)
end

def session_device_icon(session)
Expand Down
15 changes: 15 additions & 0 deletions app/javascript/mastodon/components/__tests__/hashtag_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ describe('computeHashtagBarForStatus', () => {
);
});

it('does not truncate the contents when the last child is a text node', () => {
const status = createStatus(
'this is a #<a class="zrl" href="https://example.com/search?tag=test">test</a>. Some more text',
['test'],
);

const { hashtagsInBar, statusContentProps } =
computeHashtagBarForStatus(status);

expect(hashtagsInBar).toEqual([]);
expect(statusContentProps.statusContent).toMatchInlineSnapshot(
`"this is a #<a class="zrl" href="https://example.com/search?tag=test">test</a>. Some more text"`,
);
});

it('extract tags from the last line', () => {
const status = createStatus(
'<p>Simple text</p><p><a href="test">#hashtag</a></p>',
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/hashtag_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export function computeHashtagBarForStatus(status: StatusLike): {

const lastChild = template.content.lastChild;

if (!lastChild) return defaultResult;
if (!lastChild || lastChild.nodeType === Node.TEXT_NODE) return defaultResult;

template.content.removeChild(lastChild);
const contentWithoutLastLine = template;
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/scrollable_list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ScrollableList extends PureComponent {
const clientHeight = this.getClientHeight();
const offset = scrollHeight - scrollTop - clientHeight;

if (400 > offset && this.props.onLoadMore && this.props.hasMore && !this.props.isLoading) {
if (scrollTop > 0 && offset < 400 && this.props.onLoadMore && this.props.hasMore && !this.props.isLoading) {
this.props.onLoadMore();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { IconButton } from '../../../components/icon_button';
const messages = defineMessages({
public_short: { id: 'searchability.public.short', defaultMessage: 'Public' },
public_long: { id: 'searchability.public.long', defaultMessage: 'Anyone can find' },
public_unlisted_short: { id: 'searchability.public_unlisted.short', defaultMessage: 'Public unlisted' },
public_unlisted_long: { id: 'searchability.public_unlisted.long', defaultMessage: 'Local users and followers can find' },
private_short: { id: 'searchability.unlisted.short', defaultMessage: 'Followers' },
private_long: { id: 'searchability.unlisted.long', defaultMessage: 'Your followers can find' },
direct_short: { id: 'searchability.private.short', defaultMessage: 'Reactionners' },
Expand Down Expand Up @@ -223,6 +225,7 @@ class SearchabilityDropdown extends PureComponent {

this.options = [
{ icon: 'globe', value: 'public', text: formatMessage(messages.public_short), meta: formatMessage(messages.public_long) },
{ icon: 'cloud', value: 'public_unlisted', text: formatMessage(messages.public_unlisted_short), meta: formatMessage(messages.public_unlisted_long) },
{ icon: 'unlock', value: 'private', text: formatMessage(messages.private_short), meta: formatMessage(messages.private_long) },
{ icon: 'lock', value: 'direct', text: formatMessage(messages.direct_short), meta: formatMessage(messages.direct_long) },
{ icon: 'at', value: 'limited', text: formatMessage(messages.limited_short), meta: formatMessage(messages.limited_long) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const messages = defineMessages({
personal_short: { id: 'privacy.personal.short', defaultMessage: 'Yourself only' },
direct_short: { id: 'privacy.direct.short', defaultMessage: 'Mentioned people only' },
searchability_public_short: { id: 'searchability.public.short', defaultMessage: 'Public' },
searchability_public_unlisted_short: { id: 'searchability.public_unlisted.short', defaultMessage: 'Public unlisted' },
searchability_private_short: { id: 'searchability.unlisted.short', defaultMessage: 'Followers' },
searchability_direct_short: { id: 'searchability.private.short', defaultMessage: 'Reactionners' },
searchability_limited_short: { id: 'searchability.direct.short', defaultMessage: 'Self only' },
Expand Down Expand Up @@ -270,6 +271,7 @@ class DetailedStatus extends ImmutablePureComponent {

const searchabilityIconInfo = {
'public': { icon: 'globe', text: intl.formatMessage(messages.searchability_public_short) },
'public_unlisted': { icon: 'cloud', text: intl.formatMessage(messages.searchability_public_unlisted_short) },
'private': { icon: 'unlock', text: intl.formatMessage(messages.searchability_private_short) },
'direct': { icon: 'lock', text: intl.formatMessage(messages.searchability_direct_short) },
'limited': { icon: 'at', text: intl.formatMessage(messages.searchability_limited_short) },
Expand Down
1 change: 1 addition & 0 deletions app/javascript/mastodon/locales/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
"conversation.open": "কথপোকথন দেখান",
"conversation.with": "{names} এর সঙ্গে",
"copypaste.copied": "অনুলিপিকৃত",
"copypaste.copy_to_clipboard": "ক্লিপবোর্ডে কপি করুন",
"directory.federated": "পরিচিত ফেডিভারসের থেকে",
"directory.local": "শুধু {domain} থেকে",
"directory.new_arrivals": "নতুন আগত",
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/mastodon/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,8 @@
"searchability.private.short": "Reactionners",
"searchability.public.long": "Anyone can find",
"searchability.public.short": "Everyone",
"searchability.public_unlisted.long": "Local users and followers can find",
"searchability.public_unlisted.short": "Local and followers",
"searchability.unlisted.long": "Your followers and reactionners can find",
"searchability.unlisted.short": "Followers and reactionners",
"search_popout.domain": "domain",
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@
"timeline_hint.resources.followers": "Seuraajat",
"timeline_hint.resources.follows": "seurattua",
"timeline_hint.resources.statuses": "Vanhemmat julkaisut",
"trends.counter_by_accounts": "{count, plural, one {{counter} henkilö} other {{counter} henkilöä}} viimeisten {days, plural, one {päivän} other {{days} päivän}}",
"trends.counter_by_accounts": "{count, plural, one {{counter} henkilö} other {{counter} henkilöä}} {days, plural, one {viimeisen päivän} other {viimeisten {days} päivän}} aikana",
"trends.trending_now": "Suosittua nyt",
"ui.beforeunload": "Luonnos häviää, jos poistut Mastodonista.",
"units.short.billion": "{count} mrd.",
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/mastodon/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,8 @@
"searchability.private.short": "反応者のみ",
"searchability.public.long": "この投稿は誰でも検索できます",
"searchability.public.short": "誰でも",
"searchability.public_unlisted.long": "ローカルユーザーとフォロワーが検索できます",
"searchability.public_unlisted.short": "ローカルとフォロワー",
"searchability.unlisted.long": "この投稿はあなたのフォロワーと反応者だけが検索できます",
"searchability.unlisted.short": "フォロワーと反応者",
"search_popout.domain": "ドメイン",
Expand Down
Loading

0 comments on commit 311827a

Please sign in to comment.