Merge pull request #2758 from ClearlyClaire/glitch-soc/merge-upstream

Merge upstream changes up to 2c7eed1fa1
shrike
Claire 2024-06-25 19:41:01 +02:00 committed by GitHub
commit 1eb69c5c65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 108 additions and 36 deletions

View File

@ -100,17 +100,17 @@ GEM
attr_required (1.0.2) attr_required (1.0.2)
awrence (1.2.1) awrence (1.2.1)
aws-eventstream (1.3.0) aws-eventstream (1.3.0)
aws-partitions (1.940.0) aws-partitions (1.947.0)
aws-sdk-core (3.197.0) aws-sdk-core (3.198.0)
aws-eventstream (~> 1, >= 1.3.0) aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0) aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8) aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1) jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.83.0) aws-sdk-kms (1.86.0)
aws-sdk-core (~> 3, >= 3.197.0) aws-sdk-core (~> 3, >= 3.198.0)
aws-sigv4 (~> 1.1) aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.152.3) aws-sdk-s3 (1.153.0)
aws-sdk-core (~> 3, >= 3.197.0) aws-sdk-core (~> 3, >= 3.198.0)
aws-sdk-kms (~> 1) aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8) aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0) aws-sigv4 (1.8.0)

View File

@ -59,16 +59,49 @@ export default function api(withAuthorization = true) {
}); });
} }
type RequestParamsOrData = Record<string, unknown>;
export async function apiRequest<ApiResponse = unknown>( export async function apiRequest<ApiResponse = unknown>(
method: Method, method: Method,
url: string, url: string,
params?: Record<string, unknown>, args: {
params?: RequestParamsOrData;
data?: RequestParamsOrData;
} = {},
) { ) {
const { data } = await api().request<ApiResponse>({ const { data } = await api().request<ApiResponse>({
method, method,
url: '/api/' + url, url: '/api/' + url,
data: params, ...args,
}); });
return data; return data;
} }
export async function apiRequestGet<ApiResponse = unknown>(
url: string,
params?: RequestParamsOrData,
) {
return apiRequest<ApiResponse>('GET', url, { params });
}
export async function apiRequestPost<ApiResponse = unknown>(
url: string,
data?: RequestParamsOrData,
) {
return apiRequest<ApiResponse>('POST', url, { data });
}
export async function apiRequestPut<ApiResponse = unknown>(
url: string,
data?: RequestParamsOrData,
) {
return apiRequest<ApiResponse>('PUT', url, { data });
}
export async function apiRequestDelete<ApiResponse = unknown>(
url: string,
params?: RequestParamsOrData,
) {
return apiRequest<ApiResponse>('DELETE', url, { params });
}

View File

@ -1,7 +1,7 @@
import { apiRequest } from 'flavours/glitch/api'; import { apiRequestPost } from 'flavours/glitch/api';
import type { ApiRelationshipJSON } from 'flavours/glitch/api_types/relationships'; import type { ApiRelationshipJSON } from 'flavours/glitch/api_types/relationships';
export const apiSubmitAccountNote = (id: string, value: string) => export const apiSubmitAccountNote = (id: string, value: string) =>
apiRequest<ApiRelationshipJSON>('post', `v1/accounts/${id}/note`, { apiRequestPost<ApiRelationshipJSON>(`v1/accounts/${id}/note`, {
comment: value, comment: value,
}); });

View File

@ -1,10 +1,10 @@
import { apiRequest } from 'flavours/glitch/api'; import { apiRequestPost } from 'flavours/glitch/api';
import type { Status, StatusVisibility } from 'flavours/glitch/models/status'; import type { Status, StatusVisibility } from 'flavours/glitch/models/status';
export const apiReblog = (statusId: string, visibility: StatusVisibility) => export const apiReblog = (statusId: string, visibility: StatusVisibility) =>
apiRequest<{ reblog: Status }>('post', `v1/statuses/${statusId}/reblog`, { apiRequestPost<{ reblog: Status }>(`v1/statuses/${statusId}/reblog`, {
visibility, visibility,
}); });
export const apiUnreblog = (statusId: string) => export const apiUnreblog = (statusId: string) =>
apiRequest<Status>('post', `v1/statuses/${statusId}/unreblog`); apiRequestPost<Status>(`v1/statuses/${statusId}/unreblog`);

View File

@ -1,10 +1,9 @@
import { apiRequest } from 'flavours/glitch/api'; import { apiRequestGet, apiRequestPut } from 'flavours/glitch/api';
import type { NotificationPolicyJSON } from 'flavours/glitch/api_types/notification_policies'; import type { NotificationPolicyJSON } from 'flavours/glitch/api_types/notification_policies';
export const apiGetNotificationPolicy = () => export const apiGetNotificationPolicy = () =>
apiRequest<NotificationPolicyJSON>('GET', '/v1/notifications/policy'); apiRequestGet<NotificationPolicyJSON>('/v1/notifications/policy');
export const apiUpdateNotificationsPolicy = ( export const apiUpdateNotificationsPolicy = (
policy: Partial<NotificationPolicyJSON>, policy: Partial<NotificationPolicyJSON>,
) => ) => apiRequestPut<NotificationPolicyJSON>('/v1/notifications/policy', policy);
apiRequest<NotificationPolicyJSON>('PUT', '/v1/notifications/policy', policy);

View File

@ -59,16 +59,49 @@ export default function api(withAuthorization = true) {
}); });
} }
type RequestParamsOrData = Record<string, unknown>;
export async function apiRequest<ApiResponse = unknown>( export async function apiRequest<ApiResponse = unknown>(
method: Method, method: Method,
url: string, url: string,
params?: Record<string, unknown>, args: {
params?: RequestParamsOrData;
data?: RequestParamsOrData;
} = {},
) { ) {
const { data } = await api().request<ApiResponse>({ const { data } = await api().request<ApiResponse>({
method, method,
url: '/api/' + url, url: '/api/' + url,
data: params, ...args,
}); });
return data; return data;
} }
export async function apiRequestGet<ApiResponse = unknown>(
url: string,
params?: RequestParamsOrData,
) {
return apiRequest<ApiResponse>('GET', url, { params });
}
export async function apiRequestPost<ApiResponse = unknown>(
url: string,
data?: RequestParamsOrData,
) {
return apiRequest<ApiResponse>('POST', url, { data });
}
export async function apiRequestPut<ApiResponse = unknown>(
url: string,
data?: RequestParamsOrData,
) {
return apiRequest<ApiResponse>('PUT', url, { data });
}
export async function apiRequestDelete<ApiResponse = unknown>(
url: string,
params?: RequestParamsOrData,
) {
return apiRequest<ApiResponse>('DELETE', url, { params });
}

View File

@ -1,7 +1,7 @@
import { apiRequest } from 'mastodon/api'; import { apiRequestPost } from 'mastodon/api';
import type { ApiRelationshipJSON } from 'mastodon/api_types/relationships'; import type { ApiRelationshipJSON } from 'mastodon/api_types/relationships';
export const apiSubmitAccountNote = (id: string, value: string) => export const apiSubmitAccountNote = (id: string, value: string) =>
apiRequest<ApiRelationshipJSON>('post', `v1/accounts/${id}/note`, { apiRequestPost<ApiRelationshipJSON>(`v1/accounts/${id}/note`, {
comment: value, comment: value,
}); });

View File

@ -1,10 +1,10 @@
import { apiRequest } from 'mastodon/api'; import { apiRequestPost } from 'mastodon/api';
import type { Status, StatusVisibility } from 'mastodon/models/status'; import type { Status, StatusVisibility } from 'mastodon/models/status';
export const apiReblog = (statusId: string, visibility: StatusVisibility) => export const apiReblog = (statusId: string, visibility: StatusVisibility) =>
apiRequest<{ reblog: Status }>('post', `v1/statuses/${statusId}/reblog`, { apiRequestPost<{ reblog: Status }>(`v1/statuses/${statusId}/reblog`, {
visibility, visibility,
}); });
export const apiUnreblog = (statusId: string) => export const apiUnreblog = (statusId: string) =>
apiRequest<Status>('post', `v1/statuses/${statusId}/unreblog`); apiRequestPost<Status>(`v1/statuses/${statusId}/unreblog`);

View File

@ -1,10 +1,9 @@
import { apiRequest } from 'mastodon/api'; import { apiRequestGet, apiRequestPut } from 'mastodon/api';
import type { NotificationPolicyJSON } from 'mastodon/api_types/notification_policies'; import type { NotificationPolicyJSON } from 'mastodon/api_types/notification_policies';
export const apiGetNotificationPolicy = () => export const apiGetNotificationPolicy = () =>
apiRequest<NotificationPolicyJSON>('GET', '/v1/notifications/policy'); apiRequestGet<NotificationPolicyJSON>('/v1/notifications/policy');
export const apiUpdateNotificationsPolicy = ( export const apiUpdateNotificationsPolicy = (
policy: Partial<NotificationPolicyJSON>, policy: Partial<NotificationPolicyJSON>,
) => ) => apiRequestPut<NotificationPolicyJSON>('/v1/notifications/policy', policy);
apiRequest<NotificationPolicyJSON>('PUT', '/v1/notifications/policy', policy);

View File

@ -1,18 +1,18 @@
{ {
"about.blocks": "Prižiūrimi serveriai", "about.blocks": "Prižiūrimi serveriai",
"about.contact": "Kontaktai:", "about.contact": "Kontaktai:",
"about.disclaimer": "Mastodon tai nemokama atvirojo kodo programinė įranga ir Mastodon gGmbH prekės ženklas.", "about.disclaimer": "Mastodon tai nemokama atvirojo kodo programinė įranga ir Mastodon gGmbH prekės ženklas.",
"about.domain_blocks.no_reason_available": "Priežastis nepateikta", "about.domain_blocks.no_reason_available": "Priežastis nepateikta",
"about.domain_blocks.preamble": "Mastodon paprastai leidžia peržiūrėti turinį ir bendrauti su naudotojais iš bet kurio kito fediverse esančio serverio. Šios yra išimtys, kurios buvo padarytos šiame konkrečiame serveryje.", "about.domain_blocks.preamble": "Mastodon paprastai leidžia peržiūrėti turinį ir bendrauti su naudotojais iš bet kurio kito fediverse esančio serverio. Šios yra išimtys, kurios buvo padarytos šiame konkrečiame serveryje.",
"about.domain_blocks.silenced.explanation": "Paprastai nematysi profilių ir turinio iš šio serverio, nebent jį aiškiai ieškosi arba pasirinksi jį sekdamas (-a).", "about.domain_blocks.silenced.explanation": "Paprastai nematysi profilių ir turinio iš šio serverio, nebent jį aiškiai ieškosi arba pasirinksi jį sekdamas (-a).",
"about.domain_blocks.silenced.title": "Ribota", "about.domain_blocks.silenced.title": "Ribota",
"about.domain_blocks.suspended.explanation": "Jokie duomenys iš šio serverio nebus apdorojami, saugomi ar keičiami, todėl bet kokia sąveika ar bendravimas su šio serverio naudotojais bus neįmanomas.", "about.domain_blocks.suspended.explanation": "Jokie duomenys iš šio serverio nebus apdorojami, saugomi ar keičiami, todėl bet kokia sąveika ar bendravimas su šio serverio naudotojais bus neįmanomas.",
"about.domain_blocks.suspended.title": "Uždrausta", "about.domain_blocks.suspended.title": "Pristabdyta",
"about.not_available": "Ši informacija nebuvo pateikta šiame serveryje.", "about.not_available": "Ši informacija nebuvo pateikta šiame serveryje.",
"about.powered_by": "Decentralizuota socialinė medija, kurią valdo {mastodon}", "about.powered_by": "Decentralizuota socialinė medija, veikianti pagal „{mastodon}“",
"about.rules": "Serverio taisyklės", "about.rules": "Serverio taisyklės",
"account.account_note_header": "Pastaba", "account.account_note_header": "Pastaba",
"account.add_or_remove_from_list": "Pridėti arba ištrinti iš sąrašų", "account.add_or_remove_from_list": "Pridėti arba pašalinti iš sąrašų",
"account.badges.bot": "Automatizuotas", "account.badges.bot": "Automatizuotas",
"account.badges.group": "Grupė", "account.badges.group": "Grupė",
"account.block": "Blokuoti @{name}", "account.block": "Blokuoti @{name}",

View File

@ -8,7 +8,7 @@
%strong= t('admin.statuses.media.title') %strong= t('admin.statuses.media.title')
%ul %ul
%li= filter_link_to t('generic.all'), media: nil, id: nil %li= filter_link_to t('generic.all'), media: nil, id: nil
%li= filter_link_to t('admin.statuses.with_media'), media: '1' %li= filter_link_to t('admin.statuses.with_media'), media: true
.back-link .back-link
- if params[:report_id] - if params[:report_id]
= link_to admin_report_path(params[:report_id].to_i) do = link_to admin_report_path(params[:report_id].to_i) do

View File

@ -41,6 +41,7 @@ Rails.application.configure do
:hr, :hr,
:hu, :hu,
:hy, :hy,
:ia,
:id, :id,
:ie, :ie,
:ig, :ig,

View File

@ -33,7 +33,7 @@ describe Admin::StatusesController do
context 'when filtering by media' do context 'when filtering by media' do
before do before do
get :index, params: { account_id: account.id, media: '1' } get :index, params: { account_id: account.id, media: true }
end end
it 'returns http success' do it 'returns http success' do

View File

@ -2,7 +2,14 @@
RSpec.configure do |config| RSpec.configure do |config|
config.after(:each, :js, type: :system) do config.after(:each, :js, type: :system) do
errors = page.driver.browser.logs.get(:browser) # Classes of intermittent ignorable errors
ignored_errors = [
/Error while trying to use the following icon from the Manifest/, # https://github.com/mastodon/mastodon/pull/30793
]
errors = page.driver.browser.logs.get(:browser).reject do |error|
ignored_errors.any? { |pattern| pattern.match(error.message) }
end
if errors.present? if errors.present?
aggregate_failures 'javascript errrors' do aggregate_failures 'javascript errrors' do
errors.each do |error| errors.each do |error|