Skip to content

Commit

Permalink
Merge pull request #2577 from ClearlyClaire/glitch-soc/merge-upstream
Browse files Browse the repository at this point in the history
Merge upstream changes up to 127503e
  • Loading branch information
ClearlyClaire authored Jan 18, 2024
2 parents 411efdc + 036e25f commit d80d8f6
Show file tree
Hide file tree
Showing 205 changed files with 1,332 additions and 970 deletions.
10 changes: 10 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ Rails/LexicallyScopedActionFilter:
Exclude:
- 'app/controllers/auth/*'

# Reason: These tasks are doing local work which do not need full env loaded
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsrakeenvironment
Rails/RakeEnvironment:
Exclude:
- 'lib/tasks/auto_annotate_models.rake'
- 'lib/tasks/emojis.rake'
- 'lib/tasks/mastodon.rake'
- 'lib/tasks/repo.rake'
- 'lib/tasks/statistics.rake'

# Reason: There are appropriate times to use these features
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsskipsmodelvalidations
Rails/SkipsModelValidations:
Expand Down
19 changes: 0 additions & 19 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ Bundler/OrderedGems:
Exclude:
- 'Gemfile'

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Exclude:
- 'app/models/account.rb'

Lint/NonLocalExitFromIterator:
Exclude:
- 'app/helpers/jsonld_helper.rb'
Expand Down Expand Up @@ -68,18 +61,6 @@ Rails/OutputSafety:
Exclude:
- 'config/initializers/simple_form.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Include.
# Include: **/Rakefile, **/*.rake
Rails/RakeEnvironment:
Exclude:
- 'lib/tasks/auto_annotate_models.rake'
- 'lib/tasks/db.rake'
- 'lib/tasks/emojis.rake'
- 'lib/tasks/mastodon.rake'
- 'lib/tasks/repo.rake'
- 'lib/tasks/statistics.rake'

# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/UniqueValidationWithoutIndex:
Expand Down
116 changes: 58 additions & 58 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,51 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.2)
actionpack (= 7.1.2)
activesupport (= 7.1.2)
actioncable (7.1.3)
actionpack (= 7.1.3)
activesupport (= 7.1.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.2)
actionpack (= 7.1.2)
activejob (= 7.1.2)
activerecord (= 7.1.2)
activestorage (= 7.1.2)
activesupport (= 7.1.2)
actionmailbox (7.1.3)
actionpack (= 7.1.3)
activejob (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.2)
actionpack (= 7.1.2)
actionview (= 7.1.2)
activejob (= 7.1.2)
activesupport (= 7.1.2)
actionmailer (7.1.3)
actionpack (= 7.1.3)
actionview (= 7.1.3)
activejob (= 7.1.3)
activesupport (= 7.1.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.2)
actionpack (7.1.2)
actionview (= 7.1.2)
activesupport (= 7.1.2)
actionpack (7.1.3)
actionview (= 7.1.3)
activesupport (= 7.1.3)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.2)
actionpack (= 7.1.2)
activerecord (= 7.1.2)
activestorage (= 7.1.2)
activesupport (= 7.1.2)
actiontext (7.1.3)
actionpack (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.2)
activesupport (= 7.1.2)
actionview (7.1.3)
activesupport (= 7.1.3)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
Expand All @@ -75,22 +75,22 @@ GEM
activemodel (>= 4.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (7.1.2)
activesupport (= 7.1.2)
activejob (7.1.3)
activesupport (= 7.1.3)
globalid (>= 0.3.6)
activemodel (7.1.2)
activesupport (= 7.1.2)
activerecord (7.1.2)
activemodel (= 7.1.2)
activesupport (= 7.1.2)
activemodel (7.1.3)
activesupport (= 7.1.3)
activerecord (7.1.3)
activemodel (= 7.1.3)
activesupport (= 7.1.3)
timeout (>= 0.4.0)
activestorage (7.1.2)
actionpack (= 7.1.2)
activejob (= 7.1.2)
activerecord (= 7.1.2)
activesupport (= 7.1.2)
activestorage (7.1.3)
actionpack (= 7.1.3)
activejob (= 7.1.3)
activerecord (= 7.1.3)
activesupport (= 7.1.3)
marcel (~> 1.0)
activesupport (7.1.2)
activesupport (7.1.3)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand Down Expand Up @@ -188,7 +188,7 @@ GEM
climate_control (0.2.0)
cocoon (1.2.15)
color_diff (0.1)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
cose (1.3.0)
cbor (~> 0.5.9)
Expand Down Expand Up @@ -454,15 +454,15 @@ GEM
uri
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.4.4)
net-imap (0.4.9.1)
date
net-protocol
net-ldap (0.19.0)
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-smtp (0.4.0.1)
net-protocol
nio4r (2.5.9)
nokogiri (1.16.0)
Expand Down Expand Up @@ -552,27 +552,27 @@ GEM
rack
rack-proxy (0.7.6)
rack
rack-session (1.0.1)
rack-session (1.0.2)
rack (< 3)
rack-test (2.1.0)
rack (>= 1.3)
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.2)
actioncable (= 7.1.2)
actionmailbox (= 7.1.2)
actionmailer (= 7.1.2)
actionpack (= 7.1.2)
actiontext (= 7.1.2)
actionview (= 7.1.2)
activejob (= 7.1.2)
activemodel (= 7.1.2)
activerecord (= 7.1.2)
activestorage (= 7.1.2)
activesupport (= 7.1.2)
rails (7.1.3)
actioncable (= 7.1.3)
actionmailbox (= 7.1.3)
actionmailer (= 7.1.3)
actionpack (= 7.1.3)
actiontext (= 7.1.3)
actionview (= 7.1.3)
activejob (= 7.1.3)
activemodel (= 7.1.3)
activerecord (= 7.1.3)
activestorage (= 7.1.3)
activesupport (= 7.1.3)
bundler (>= 1.15.0)
railties (= 7.1.2)
railties (= 7.1.3)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -587,9 +587,9 @@ GEM
rails-i18n (7.0.8)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.1.2)
actionpack (= 7.1.2)
activesupport (= 7.1.2)
railties (7.1.3)
actionpack (= 7.1.3)
activesupport (= 7.1.3)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
Expand Down Expand Up @@ -955,4 +955,4 @@ RUBY VERSION
ruby 3.2.2p53

BUNDLED WITH
2.4.20
2.5.4
10 changes: 7 additions & 3 deletions app/helpers/accounts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,26 @@ def hide_followers_count?(account)
Setting.hide_followers_count || account.user&.settings&.[]('hide_followers_count')
end

def account_formatted_stat(value)
number_to_human(value, precision: 3, strip_insignificant_zeros: true)
end

def account_description(account)
prepend_stats = [
[
number_to_human(account.statuses_count, precision: 3, strip_insignificant_zeros: true),
account_formatted_stat(account.statuses_count),
I18n.t('accounts.posts', count: account.statuses_count),
].join(' '),

[
number_to_human(account.following_count, precision: 3, strip_insignificant_zeros: true),
account_formatted_stat(account.following_count),
I18n.t('accounts.following', count: account.following_count),
].join(' '),
]

unless hide_followers_count?(account)
prepend_stats << [
number_to_human(account.followers_count, precision: 3, strip_insignificant_zeros: true),
account_formatted_stat(account.followers_count),
I18n.t('accounts.followers', count: account.followers_count),
].join(' ')
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/mascot_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module MascotHelper
def mascot_url
full_asset_url(instance_presenter.mascot&.file&.url || asset_pack_path('media/images/elephant_ui_plane.svg'))
full_asset_url(instance_presenter.mascot&.file&.url || frontend_asset_path('images/elephant_ui_plane.svg'))
end

def instance_presenter
Expand Down
8 changes: 6 additions & 2 deletions app/helpers/routing_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ def asset_host
Rails.configuration.action_controller.asset_host || root_url
end

def full_pack_url(source, **options)
full_asset_url(asset_pack_path(source, **options))
def frontend_asset_path(source, **options)
asset_pack_path("media/#{source}", **options)
end

def frontend_asset_url(source, **options)
full_asset_url(frontend_asset_path(source, **options))
end

def use_storage?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class Item extends PureComponent {
}

if (attachment.get('description')?.length > 0) {
badges.push(<span key='alt' className='media-gallery__gifv__label'>ALT</span>);
badges.push(<span key='alt' className='media-gallery__alt__label'>ALT</span>);
}

const description = attachment.getIn(['translation', 'description']) || attachment.get('description');
Expand Down
22 changes: 8 additions & 14 deletions app/javascript/flavours/glitch/reducers/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,19 @@ export const accountsReducer: Reducer<typeof initialState> = (
return normalizeAccounts(state, action.payload.accounts);
else if (followAccountSuccess.match(action)) {
return state
.update(
action.payload.relationship.id,
(account) => account?.update('followers_count', (n) => n + 1),
.update(action.payload.relationship.id, (account) =>
account?.update('followers_count', (n) => n + 1),
)
.update(
getCurrentUser(),
(account) => account?.update('following_count', (n) => n + 1),
.update(getCurrentUser(), (account) =>
account?.update('following_count', (n) => n + 1),
);
} else if (unfollowAccountSuccess.match(action))
return state
.update(
action.payload.relationship.id,
(account) =>
account?.update('followers_count', (n) => Math.max(0, n - 1)),
.update(action.payload.relationship.id, (account) =>
account?.update('followers_count', (n) => Math.max(0, n - 1)),
)
.update(
getCurrentUser(),
(account) =>
account?.update('following_count', (n) => Math.max(0, n - 1)),
.update(getCurrentUser(), (account) =>
account?.update('following_count', (n) => Math.max(0, n - 1)),
);
else return state;
};
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,13 @@
span {
user-select: all;
}

.icon-lock {
height: 16px;
width: 16px;
position: relative;
top: 3px;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
gap: 2px;
}

.media-gallery__alt__label,
.media-gallery__gifv__label {
display: flex;
align-items: center;
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/flavours/glitch/styles/components/modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,10 @@
padding-inline-end: 10px;
}

.icon {
vertical-align: middle;
}

.button {
flex: 0 0 auto;
}
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/flavours/glitch/styles/components/status.scss
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,7 @@
.icon {
width: 15px;
height: 15px;
position: relative;
top: 0.145em;
vertical-align: middle;
}
}

Expand Down Expand Up @@ -1001,6 +1000,7 @@ a.status-card.compact:hover {

.icon {
color: $dark-text-color;
vertical-align: middle;
}
}
}
Expand Down
Loading

0 comments on commit d80d8f6

Please sign in to comment.