Skip to content

Commit

Permalink
Merge branch 'kb_development' into kb-draft-12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Apr 27, 2024
2 parents 86adad7 + 06917cb commit 1e25b59
Show file tree
Hide file tree
Showing 114 changed files with 1,264 additions and 570 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ yarn-debug.log

# Ignore Docker option files
docker-compose.override.yml

# Ignore dotenv .local files
.env*.local
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ Style/FormatStringToken:
AllowedMethods:
- redirect_with_vary

# Reason: Prevailing style choice
# https://docs.rubocop.org/rubocop/cops_style.html#stylehashaslastarrayitem
Style/HashAsLastArrayItem:
Enabled: false

# Reason: Enforce modern Ruby style
# https://docs.rubocop.org/rubocop/cops_style.html#stylehashsyntax
Style/HashSyntax:
Expand Down
13 changes: 0 additions & 13 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,6 @@ Style/GuardClause:
- 'lib/mastodon/cli/media.rb'
- 'lib/tasks/repo.rake'

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: braces, no_braces
Style/HashAsLastArrayItem:
Exclude:
- 'app/controllers/admin/statuses_controller.rb'
- 'app/controllers/api/v1/statuses_controller.rb'
- 'app/models/concerns/account/counters.rb'
- 'app/models/concerns/status/threading_concern.rb'
- 'app/models/status.rb'
- 'app/services/batched_remove_status_service.rb'
- 'app/services/notify_service.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
Style/HashTransformValues:
Exclude:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.3
3.2.4
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
ARG TARGETPLATFORM=${TARGETPLATFORM}
ARG BUILDPLATFORM=${BUILDPLATFORM}

# Ruby image to use for base image, change with [--build-arg RUBY_VERSION="3.2.3"]
ARG RUBY_VERSION="3.2.3"
# Ruby image to use for base image, change with [--build-arg RUBY_VERSION="3.2.4"]
ARG RUBY_VERSION="3.2.4"
# # Node version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="20"]
ARG NODE_MAJOR_VERSION="20"
# Debian image to use for base image, change with [--build-arg DEBIAN_VERSION="bookworm"]
ARG DEBIAN_VERSION="bookworm"
# Node image to use for base image based on combined variables (ex: 20-bookworm-slim)
FROM docker.io/node:${NODE_MAJOR_VERSION}-${DEBIAN_VERSION}-slim as node
# Ruby image to use for base image based on combined variables (ex: 3.2.3-slim-bookworm)
# Ruby image to use for base image based on combined variables (ex: 3.2.4-slim-bookworm)
FROM docker.io/ruby:${RUBY_VERSION}-slim-${DEBIAN_VERSION} as ruby

# Resulting version string is vX.X.X-MASTODON_VERSION_PRERELEASE+MASTODON_VERSION_METADATA
Expand All @@ -29,7 +29,7 @@ ARG MASTODON_VERSION_METADATA=""
# See: https://docs.joinmastodon.org/admin/config/#rails_serve_static_files
ARG RAILS_SERVE_STATIC_FILES="true"
# Allow to use YJIT compiler
# See: https://github.com/ruby/ruby/blob/v3_2_3/doc/yjit/yjit.md
# See: https://github.com/ruby/ruby/blob/v3_2_4/doc/yjit/yjit.md
ARG RUBY_YJIT_ENABLE="1"
# Timezone used by the Docker container and runtime, change with [--build-arg TZ=Europe/Berlin]
ARG TZ="Etc/UTC"
Expand Down Expand Up @@ -262,4 +262,4 @@ USER mastodon
# Expose default Puma ports
EXPOSE 3000
# Set container tini as default entry point
ENTRYPOINT ["/usr/bin/tini", "--"]
ENTRYPOINT ["/usr/bin/tini", "--"]
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ GEM
scenic (1.8.0)
activerecord (>= 4.0.0)
railties (>= 4.0.0)
selenium-webdriver (4.19.0)
selenium-webdriver (4.20.1)
base64 (~> 0.2)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def edit_status_account_id
return @edit_account_id || @account.id if @edit_account_checked

@edit_account_checked = true
@edit_account_id = Account.local.find_by(username: 'official')&.id || @account.id
@edit_account_id = Account.representative.id
end

def filter_params
Expand Down
11 changes: 7 additions & 4 deletions app/javascript/mastodon/actions/markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { List as ImmutableList } from 'immutable';
import { debounce } from 'lodash';

import type { MarkerJSON } from 'mastodon/api_types/markers';
import type { RootState } from 'mastodon/store';
import type { AppDispatch, RootState } from 'mastodon/store';
import { createAppAsyncThunk } from 'mastodon/store/typed_functions';

import api, { authorizationTokenFromState } from '../api';
Expand Down Expand Up @@ -72,18 +72,21 @@ interface MarkerParam {
}

function getLastHomeId(state: RootState): string | undefined {
/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access */
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return (
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
state
// @ts-expect-error state.timelines is not yet typed
.getIn(['timelines', 'home', 'items'], ImmutableList())
// @ts-expect-error state.timelines is not yet typed
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
.find((item) => item !== null)
);
}

function getLastNotificationId(state: RootState): string | undefined {
// @ts-expect-error state.notifications is not yet typed
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
return state.getIn(['notifications', 'lastReadId']);
}

Expand Down Expand Up @@ -131,8 +134,8 @@ export const submitMarkersAction = createAppAsyncThunk<{
});

const debouncedSubmitMarkers = debounce(
(dispatch) => {
dispatch(submitMarkersAction());
(dispatch: AppDispatch) => {
void dispatch(submitMarkersAction());
},
300000,
{
Expand Down
9 changes: 1 addition & 8 deletions app/javascript/mastodon/actions/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ export function updateNotifications(notification, intlMessages, intlLocale) {
if (notification.status) {
dispatch(importFetchedStatus(notification.status));
}
if (notification.statuses) {
dispatch(importFetchedStatuses(notification.statuses));
}

if (notification.report) {
dispatch(importFetchedAccount(notification.report.target_account));
Expand Down Expand Up @@ -182,7 +179,6 @@ const excludeTypesFromFilter = filter => {
'status',
'list_status',
'update',
'account_warning',
'admin.sign_up',
'admin.report',
]);
Expand Down Expand Up @@ -241,10 +237,7 @@ export function expandNotifications({ maxId, forceLoad } = {}, done = noOp) {
const next = getLinks(response).refs.find(link => link.rel === 'next');

dispatch(importFetchedAccounts(response.data.map(item => item.account)));
dispatch(importFetchedStatuses(
response.data.map(item => item.status).filter(status => !!status)
.concat(response.data.flatMap(item => item.statuses || []))
));
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
dispatch(importFetchedAccounts(response.data.filter(item => item.report).map(item => item.report.target_account)));

dispatch(expandNotificationsSuccess(response.data, next ? next.uri : null, isLoadingMore, isLoadingRecent, isLoadingRecent && preferPendingItems));
Expand Down
Loading

0 comments on commit 1e25b59

Please sign in to comment.