Merge remote-tracking branch 'upstream/main'
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
e19315b0cd
217 changed files with 2073 additions and 1671 deletions
|
@ -2,6 +2,7 @@ version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
|
working_dir: /workspaces/mastodon/
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
|
|
@ -176,12 +176,6 @@ Style/SafeNavigation:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/concerns/account/finder_concern.rb'
|
- 'app/models/concerns/account/finder_concern.rb'
|
||||||
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: Mode.
|
|
||||||
Style/StringConcatenation:
|
|
||||||
Exclude:
|
|
||||||
- 'config/initializers/paperclip.rb'
|
|
||||||
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: WordRegex.
|
# Configuration parameters: WordRegex.
|
||||||
# SupportedStyles: percent, brackets
|
# SupportedStyles: percent, brackets
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -103,6 +103,8 @@ gem 'rdf-normalize', '~> 0.5'
|
||||||
|
|
||||||
gem 'private_address_check', '~> 0.5'
|
gem 'private_address_check', '~> 0.5'
|
||||||
|
|
||||||
|
gem 'opentelemetry-api', '~> 1.2.5'
|
||||||
|
|
||||||
group :opentelemetry do
|
group :opentelemetry do
|
||||||
gem 'opentelemetry-exporter-otlp', '~> 0.26.3', require: false
|
gem 'opentelemetry-exporter-otlp', '~> 0.26.3', require: false
|
||||||
gem 'opentelemetry-instrumentation-active_job', '~> 0.7.1', require: false
|
gem 'opentelemetry-instrumentation-active_job', '~> 0.7.1', require: false
|
||||||
|
|
11
Gemfile.lock
11
Gemfile.lock
|
@ -231,7 +231,7 @@ GEM
|
||||||
tzinfo
|
tzinfo
|
||||||
excon (0.110.0)
|
excon (0.110.0)
|
||||||
fabrication (2.31.0)
|
fabrication (2.31.0)
|
||||||
faker (3.3.1)
|
faker (3.4.1)
|
||||||
i18n (>= 1.8.11, < 2)
|
i18n (>= 1.8.11, < 2)
|
||||||
faraday (1.10.3)
|
faraday (1.10.3)
|
||||||
faraday-em_http (~> 1.0)
|
faraday-em_http (~> 1.0)
|
||||||
|
@ -425,7 +425,7 @@ GEM
|
||||||
mime-types-data (3.2024.0507)
|
mime-types-data (3.2024.0507)
|
||||||
mini_mime (1.1.5)
|
mini_mime (1.1.5)
|
||||||
mini_portile2 (2.8.6)
|
mini_portile2 (2.8.6)
|
||||||
minitest (5.23.0)
|
minitest (5.23.1)
|
||||||
msgpack (1.7.2)
|
msgpack (1.7.2)
|
||||||
multi_json (1.15.0)
|
multi_json (1.15.0)
|
||||||
multipart-post (2.4.0)
|
multipart-post (2.4.0)
|
||||||
|
@ -726,7 +726,7 @@ GEM
|
||||||
rspec-mocks (~> 3.0)
|
rspec-mocks (~> 3.0)
|
||||||
sidekiq (>= 5, < 8)
|
sidekiq (>= 5, < 8)
|
||||||
rspec-support (3.13.1)
|
rspec-support (3.13.1)
|
||||||
rubocop (1.63.5)
|
rubocop (1.64.0)
|
||||||
json (~> 2.3)
|
json (~> 2.3)
|
||||||
language_server-protocol (>= 3.17.0)
|
language_server-protocol (>= 3.17.0)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
|
@ -799,7 +799,7 @@ GEM
|
||||||
thor (>= 0.20, < 3.0)
|
thor (>= 0.20, < 3.0)
|
||||||
simple-navigation (4.4.0)
|
simple-navigation (4.4.0)
|
||||||
activesupport (>= 2.3.2)
|
activesupport (>= 2.3.2)
|
||||||
simple_form (5.3.0)
|
simple_form (5.3.1)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
activemodel (>= 5.2)
|
activemodel (>= 5.2)
|
||||||
simplecov (0.22.0)
|
simplecov (0.22.0)
|
||||||
|
@ -877,7 +877,7 @@ GEM
|
||||||
webfinger (1.2.0)
|
webfinger (1.2.0)
|
||||||
activesupport
|
activesupport
|
||||||
httpclient (>= 2.4)
|
httpclient (>= 2.4)
|
||||||
webmock (3.23.0)
|
webmock (3.23.1)
|
||||||
addressable (>= 2.8.0)
|
addressable (>= 2.8.0)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
hashdiff (>= 0.4.0, < 2.0.0)
|
hashdiff (>= 0.4.0, < 2.0.0)
|
||||||
|
@ -975,6 +975,7 @@ DEPENDENCIES
|
||||||
omniauth-rails_csrf_protection (~> 1.0)
|
omniauth-rails_csrf_protection (~> 1.0)
|
||||||
omniauth-saml (~> 2.0)
|
omniauth-saml (~> 2.0)
|
||||||
omniauth_openid_connect (~> 0.6.1)
|
omniauth_openid_connect (~> 0.6.1)
|
||||||
|
opentelemetry-api (~> 1.2.5)
|
||||||
opentelemetry-exporter-otlp (~> 0.26.3)
|
opentelemetry-exporter-otlp (~> 0.26.3)
|
||||||
opentelemetry-instrumentation-active_job (~> 0.7.1)
|
opentelemetry-instrumentation-active_job (~> 0.7.1)
|
||||||
opentelemetry-instrumentation-active_model_serializers (~> 0.20.1)
|
opentelemetry-instrumentation-active_model_serializers (~> 0.20.1)
|
||||||
|
|
|
@ -106,11 +106,11 @@ class Api::V1::AccountsController < Api::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def account_ids
|
def account_ids
|
||||||
Array(accounts_params[:ids]).uniq.map(&:to_i)
|
Array(accounts_params[:id]).uniq.map(&:to_i)
|
||||||
end
|
end
|
||||||
|
|
||||||
def accounts_params
|
def accounts_params
|
||||||
params.permit(ids: [])
|
params.permit(id: [])
|
||||||
end
|
end
|
||||||
|
|
||||||
def account_params
|
def account_params
|
||||||
|
|
|
@ -38,15 +38,15 @@ class Api::V1::ConversationsController < Api::BaseController
|
||||||
def paginated_conversations
|
def paginated_conversations
|
||||||
AccountConversation.where(account: current_account)
|
AccountConversation.where(account: current_account)
|
||||||
.includes(
|
.includes(
|
||||||
account: :account_stat,
|
account: [:account_stat, user: :role],
|
||||||
last_status: [
|
last_status: [
|
||||||
:media_attachments,
|
:media_attachments,
|
||||||
:status_stat,
|
:status_stat,
|
||||||
:tags,
|
:tags,
|
||||||
{
|
{
|
||||||
preview_cards_status: :preview_card,
|
preview_cards_status: { preview_card: { author_account: [:account_stat, user: :role] } },
|
||||||
active_mentions: [account: :account_stat],
|
active_mentions: :account,
|
||||||
account: :account_stat,
|
account: [:account_stat, user: :role],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -141,11 +141,11 @@ class Api::V1::StatusesController < Api::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def status_ids
|
def status_ids
|
||||||
Array(statuses_params[:ids]).uniq.map(&:to_i)
|
Array(statuses_params[:id]).uniq.map(&:to_i)
|
||||||
end
|
end
|
||||||
|
|
||||||
def statuses_params
|
def statuses_params
|
||||||
params.permit(ids: [])
|
params.permit(id: [])
|
||||||
end
|
end
|
||||||
|
|
||||||
def status_params
|
def status_params
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_resource(hash = nil)
|
def build_resource(hash = nil)
|
||||||
super(hash)
|
super
|
||||||
|
|
||||||
resource.locale = I18n.locale
|
resource.locale = I18n.locale
|
||||||
resource.invite_code = @invite&.code if resource.invite_code.blank?
|
resource.invite_code = @invite&.code if resource.invite_code.blank?
|
||||||
|
|
|
@ -65,7 +65,7 @@ window.addEventListener('message', (e) => {
|
||||||
{
|
{
|
||||||
type: 'setHeight',
|
type: 'setHeight',
|
||||||
id: data.id,
|
id: data.id,
|
||||||
height: document.getElementsByTagName('html')[0].scrollHeight,
|
height: document.getElementsByTagName('html')[0]?.scrollHeight,
|
||||||
},
|
},
|
||||||
'*',
|
'*',
|
||||||
);
|
);
|
||||||
|
@ -135,7 +135,7 @@ function loaded() {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const todayFormat = new IntlMessageFormat(
|
const todayFormat = new IntlMessageFormat(
|
||||||
localeData['relative_format.today'] || 'Today at {time}',
|
localeData['relative_format.today'] ?? 'Today at {time}',
|
||||||
locale,
|
locale,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -288,13 +288,13 @@ function loaded() {
|
||||||
if (statusEl.dataset.spoiler === 'expanded') {
|
if (statusEl.dataset.spoiler === 'expanded') {
|
||||||
statusEl.dataset.spoiler = 'folded';
|
statusEl.dataset.spoiler = 'folded';
|
||||||
this.textContent = new IntlMessageFormat(
|
this.textContent = new IntlMessageFormat(
|
||||||
localeData['status.show_more'] || 'Show more',
|
localeData['status.show_more'] ?? 'Show more',
|
||||||
locale,
|
locale,
|
||||||
).format() as string;
|
).format() as string;
|
||||||
} else {
|
} else {
|
||||||
statusEl.dataset.spoiler = 'expanded';
|
statusEl.dataset.spoiler = 'expanded';
|
||||||
this.textContent = new IntlMessageFormat(
|
this.textContent = new IntlMessageFormat(
|
||||||
localeData['status.show_less'] || 'Show less',
|
localeData['status.show_less'] ?? 'Show less',
|
||||||
locale,
|
locale,
|
||||||
).format() as string;
|
).format() as string;
|
||||||
}
|
}
|
||||||
|
@ -316,8 +316,8 @@ function loaded() {
|
||||||
|
|
||||||
const message =
|
const message =
|
||||||
statusEl.dataset.spoiler === 'expanded'
|
statusEl.dataset.spoiler === 'expanded'
|
||||||
? localeData['status.show_less'] || 'Show less'
|
? localeData['status.show_less'] ?? 'Show less'
|
||||||
: localeData['status.show_more'] || 'Show more';
|
: localeData['status.show_more'] ?? 'Show more';
|
||||||
spoilerLink.textContent = new IntlMessageFormat(
|
spoilerLink.textContent = new IntlMessageFormat(
|
||||||
message,
|
message,
|
||||||
locale,
|
locale,
|
||||||
|
|
|
@ -67,7 +67,9 @@ const fetchInteractionURLFailure = () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isValidDomain = (value: string) => {
|
const isValidDomain = (value: unknown) => {
|
||||||
|
if (typeof value !== 'string') return false;
|
||||||
|
|
||||||
const url = new URL('https:///path');
|
const url = new URL('https:///path');
|
||||||
url.hostname = value;
|
url.hostname = value;
|
||||||
return url.hostname === value;
|
return url.hostname === value;
|
||||||
|
@ -124,6 +126,11 @@ const fromAcct = (acct: string) => {
|
||||||
const domain = segments[1];
|
const domain = segments[1];
|
||||||
const fallbackTemplate = `https://${domain}/authorize_interaction?uri={uri}`;
|
const fallbackTemplate = `https://${domain}/authorize_interaction?uri={uri}`;
|
||||||
|
|
||||||
|
if (!domain) {
|
||||||
|
fetchInteractionURLFailure();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.get(`https://${domain}/.well-known/webfinger`, {
|
.get(`https://${domain}/.well-known/webfinger`, {
|
||||||
params: { resource: `acct:${acct}` },
|
params: { resource: `acct:${acct}` },
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
import type { ApiRelationshipJSON } from 'mastodon/api_types/relationships';
|
import { apiSubmitAccountNote } from 'mastodon/api/accounts';
|
||||||
import { createAppAsyncThunk } from 'mastodon/store/typed_functions';
|
import { createDataLoadingThunk } from 'mastodon/store/typed_functions';
|
||||||
|
|
||||||
import api from '../api';
|
export const submitAccountNote = createDataLoadingThunk(
|
||||||
|
|
||||||
export const submitAccountNote = createAppAsyncThunk(
|
|
||||||
'account_note/submit',
|
'account_note/submit',
|
||||||
async (args: { id: string; value: string }, { getState }) => {
|
({ accountId, note }: { accountId: string; note: string }) =>
|
||||||
const response = await api(getState).post<ApiRelationshipJSON>(
|
apiSubmitAccountNote(accountId, note),
|
||||||
`/api/v1/accounts/${args.id}/note`,
|
(relationship) => ({ relationship }),
|
||||||
{
|
{ skipLoading: true },
|
||||||
comment: args.value,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
return { relationship: response.data };
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
|
@ -76,11 +76,11 @@ export const ACCOUNT_REVEAL = 'ACCOUNT_REVEAL';
|
||||||
export * from './accounts_typed';
|
export * from './accounts_typed';
|
||||||
|
|
||||||
export function fetchAccount(id) {
|
export function fetchAccount(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchRelationships([id]));
|
dispatch(fetchRelationships([id]));
|
||||||
dispatch(fetchAccountRequest(id));
|
dispatch(fetchAccountRequest(id));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/accounts/${id}`).then(response => {
|
api().get(`/api/v1/accounts/${id}`).then(response => {
|
||||||
dispatch(importFetchedAccount(response.data));
|
dispatch(importFetchedAccount(response.data));
|
||||||
dispatch(fetchAccountSuccess());
|
dispatch(fetchAccountSuccess());
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -89,10 +89,10 @@ export function fetchAccount(id) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const lookupAccount = acct => (dispatch, getState) => {
|
export const lookupAccount = acct => (dispatch) => {
|
||||||
dispatch(lookupAccountRequest(acct));
|
dispatch(lookupAccountRequest(acct));
|
||||||
|
|
||||||
api(getState).get('/api/v1/accounts/lookup', { params: { acct } }).then(response => {
|
api().get('/api/v1/accounts/lookup', { params: { acct } }).then(response => {
|
||||||
dispatch(fetchRelationships([response.data.id]));
|
dispatch(fetchRelationships([response.data.id]));
|
||||||
dispatch(importFetchedAccount(response.data));
|
dispatch(importFetchedAccount(response.data));
|
||||||
dispatch(lookupAccountSuccess());
|
dispatch(lookupAccountSuccess());
|
||||||
|
@ -146,7 +146,7 @@ export function followAccount(id, options = { reblogs: true }) {
|
||||||
|
|
||||||
dispatch(followAccountRequest({ id, locked }));
|
dispatch(followAccountRequest({ id, locked }));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/accounts/${id}/follow`, options).then(response => {
|
api().post(`/api/v1/accounts/${id}/follow`, options).then(response => {
|
||||||
dispatch(followAccountSuccess({relationship: response.data, alreadyFollowing}));
|
dispatch(followAccountSuccess({relationship: response.data, alreadyFollowing}));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(followAccountFail({ id, error, locked }));
|
dispatch(followAccountFail({ id, error, locked }));
|
||||||
|
@ -158,7 +158,7 @@ export function unfollowAccount(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch(unfollowAccountRequest(id));
|
dispatch(unfollowAccountRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/accounts/${id}/unfollow`).then(response => {
|
api().post(`/api/v1/accounts/${id}/unfollow`).then(response => {
|
||||||
dispatch(unfollowAccountSuccess({relationship: response.data, statuses: getState().get('statuses')}));
|
dispatch(unfollowAccountSuccess({relationship: response.data, statuses: getState().get('statuses')}));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(unfollowAccountFail({ id, error }));
|
dispatch(unfollowAccountFail({ id, error }));
|
||||||
|
@ -170,7 +170,7 @@ export function blockAccount(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch(blockAccountRequest(id));
|
dispatch(blockAccountRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/accounts/${id}/block`).then(response => {
|
api().post(`/api/v1/accounts/${id}/block`).then(response => {
|
||||||
// Pass in entire statuses map so we can use it to filter stuff in different parts of the reducers
|
// Pass in entire statuses map so we can use it to filter stuff in different parts of the reducers
|
||||||
dispatch(blockAccountSuccess({ relationship: response.data, statuses: getState().get('statuses') }));
|
dispatch(blockAccountSuccess({ relationship: response.data, statuses: getState().get('statuses') }));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -180,10 +180,10 @@ export function blockAccount(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unblockAccount(id) {
|
export function unblockAccount(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(unblockAccountRequest(id));
|
dispatch(unblockAccountRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/accounts/${id}/unblock`).then(response => {
|
api().post(`/api/v1/accounts/${id}/unblock`).then(response => {
|
||||||
dispatch(unblockAccountSuccess({ relationship: response.data }));
|
dispatch(unblockAccountSuccess({ relationship: response.data }));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(unblockAccountFail({ id, error }));
|
dispatch(unblockAccountFail({ id, error }));
|
||||||
|
@ -223,7 +223,7 @@ export function muteAccount(id, notifications, duration=0) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch(muteAccountRequest(id));
|
dispatch(muteAccountRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/accounts/${id}/mute`, { notifications, duration }).then(response => {
|
api().post(`/api/v1/accounts/${id}/mute`, { notifications, duration }).then(response => {
|
||||||
// Pass in entire statuses map so we can use it to filter stuff in different parts of the reducers
|
// Pass in entire statuses map so we can use it to filter stuff in different parts of the reducers
|
||||||
dispatch(muteAccountSuccess({ relationship: response.data, statuses: getState().get('statuses') }));
|
dispatch(muteAccountSuccess({ relationship: response.data, statuses: getState().get('statuses') }));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -233,10 +233,10 @@ export function muteAccount(id, notifications, duration=0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unmuteAccount(id) {
|
export function unmuteAccount(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(unmuteAccountRequest(id));
|
dispatch(unmuteAccountRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/accounts/${id}/unmute`).then(response => {
|
api().post(`/api/v1/accounts/${id}/unmute`).then(response => {
|
||||||
dispatch(unmuteAccountSuccess({ relationship: response.data }));
|
dispatch(unmuteAccountSuccess({ relationship: response.data }));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(unmuteAccountFail({ id, error }));
|
dispatch(unmuteAccountFail({ id, error }));
|
||||||
|
@ -274,10 +274,10 @@ export function unmuteAccountFail(error) {
|
||||||
|
|
||||||
|
|
||||||
export function fetchFollowers(id) {
|
export function fetchFollowers(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchFollowersRequest(id));
|
dispatch(fetchFollowersRequest(id));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/accounts/${id}/followers`).then(response => {
|
api().get(`/api/v1/accounts/${id}/followers`).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
|
@ -324,7 +324,7 @@ export function expandFollowers(id) {
|
||||||
|
|
||||||
dispatch(expandFollowersRequest(id));
|
dispatch(expandFollowersRequest(id));
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
|
@ -361,10 +361,10 @@ export function expandFollowersFail(id, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchFollowing(id) {
|
export function fetchFollowing(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchFollowingRequest(id));
|
dispatch(fetchFollowingRequest(id));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/accounts/${id}/following`).then(response => {
|
api().get(`/api/v1/accounts/${id}/following`).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
|
@ -411,7 +411,7 @@ export function expandFollowing(id) {
|
||||||
|
|
||||||
dispatch(expandFollowingRequest(id));
|
dispatch(expandFollowingRequest(id));
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
|
@ -460,7 +460,7 @@ export function fetchRelationships(accountIds) {
|
||||||
|
|
||||||
dispatch(fetchRelationshipsRequest(newAccountIds));
|
dispatch(fetchRelationshipsRequest(newAccountIds));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/accounts/relationships?with_suspended=true&${newAccountIds.map(id => `id[]=${id}`).join('&')}`).then(response => {
|
api().get(`/api/v1/accounts/relationships?with_suspended=true&${newAccountIds.map(id => `id[]=${id}`).join('&')}`).then(response => {
|
||||||
dispatch(fetchRelationshipsSuccess({ relationships: response.data }));
|
dispatch(fetchRelationshipsSuccess({ relationships: response.data }));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(fetchRelationshipsFail(error));
|
dispatch(fetchRelationshipsFail(error));
|
||||||
|
@ -486,10 +486,10 @@ export function fetchRelationshipsFail(error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchFollowRequests() {
|
export function fetchFollowRequests() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchFollowRequestsRequest());
|
dispatch(fetchFollowRequestsRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/follow_requests').then(response => {
|
api().get('/api/v1/follow_requests').then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
dispatch(fetchFollowRequestsSuccess(response.data, next ? next.uri : null));
|
dispatch(fetchFollowRequestsSuccess(response.data, next ? next.uri : null));
|
||||||
|
@ -528,7 +528,7 @@ export function expandFollowRequests() {
|
||||||
|
|
||||||
dispatch(expandFollowRequestsRequest());
|
dispatch(expandFollowRequestsRequest());
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
dispatch(expandFollowRequestsSuccess(response.data, next ? next.uri : null));
|
dispatch(expandFollowRequestsSuccess(response.data, next ? next.uri : null));
|
||||||
|
@ -558,10 +558,10 @@ export function expandFollowRequestsFail(error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function authorizeFollowRequest(id) {
|
export function authorizeFollowRequest(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(authorizeFollowRequestRequest(id));
|
dispatch(authorizeFollowRequestRequest(id));
|
||||||
|
|
||||||
api(getState)
|
api()
|
||||||
.post(`/api/v1/follow_requests/${id}/authorize`)
|
.post(`/api/v1/follow_requests/${id}/authorize`)
|
||||||
.then(() => dispatch(authorizeFollowRequestSuccess({ id })))
|
.then(() => dispatch(authorizeFollowRequestSuccess({ id })))
|
||||||
.catch(error => dispatch(authorizeFollowRequestFail(id, error)));
|
.catch(error => dispatch(authorizeFollowRequestFail(id, error)));
|
||||||
|
@ -585,10 +585,10 @@ export function authorizeFollowRequestFail(id, error) {
|
||||||
|
|
||||||
|
|
||||||
export function rejectFollowRequest(id) {
|
export function rejectFollowRequest(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(rejectFollowRequestRequest(id));
|
dispatch(rejectFollowRequestRequest(id));
|
||||||
|
|
||||||
api(getState)
|
api()
|
||||||
.post(`/api/v1/follow_requests/${id}/reject`)
|
.post(`/api/v1/follow_requests/${id}/reject`)
|
||||||
.then(() => dispatch(rejectFollowRequestSuccess({ id })))
|
.then(() => dispatch(rejectFollowRequestSuccess({ id })))
|
||||||
.catch(error => dispatch(rejectFollowRequestFail(id, error)));
|
.catch(error => dispatch(rejectFollowRequestFail(id, error)));
|
||||||
|
@ -611,10 +611,10 @@ export function rejectFollowRequestFail(id, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pinAccount(id) {
|
export function pinAccount(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(pinAccountRequest(id));
|
dispatch(pinAccountRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/accounts/${id}/pin`).then(response => {
|
api().post(`/api/v1/accounts/${id}/pin`).then(response => {
|
||||||
dispatch(pinAccountSuccess({ relationship: response.data }));
|
dispatch(pinAccountSuccess({ relationship: response.data }));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(pinAccountFail(error));
|
dispatch(pinAccountFail(error));
|
||||||
|
@ -623,10 +623,10 @@ export function pinAccount(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unpinAccount(id) {
|
export function unpinAccount(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(unpinAccountRequest(id));
|
dispatch(unpinAccountRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/accounts/${id}/unpin`).then(response => {
|
api().post(`/api/v1/accounts/${id}/unpin`).then(response => {
|
||||||
dispatch(unpinAccountSuccess({ relationship: response.data }));
|
dispatch(unpinAccountSuccess({ relationship: response.data }));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(unpinAccountFail(error));
|
dispatch(unpinAccountFail(error));
|
||||||
|
@ -662,7 +662,7 @@ export function unpinAccountFail(error) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const updateAccount = ({ displayName, note, avatar, header, discoverable, indexable }) => (dispatch, getState) => {
|
export const updateAccount = ({ displayName, note, avatar, header, discoverable, indexable }) => (dispatch) => {
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
|
|
||||||
data.append('display_name', displayName);
|
data.append('display_name', displayName);
|
||||||
|
@ -672,7 +672,7 @@ export const updateAccount = ({ displayName, note, avatar, header, discoverable,
|
||||||
data.append('discoverable', discoverable);
|
data.append('discoverable', discoverable);
|
||||||
data.append('indexable', indexable);
|
data.append('indexable', indexable);
|
||||||
|
|
||||||
return api(getState).patch('/api/v1/accounts/update_credentials', data).then(response => {
|
return api().patch('/api/v1/accounts/update_credentials', data).then(response => {
|
||||||
dispatch(importFetchedAccount(response.data));
|
dispatch(importFetchedAccount(response.data));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,10 +26,10 @@ export const ANNOUNCEMENTS_TOGGLE_SHOW = 'ANNOUNCEMENTS_TOGGLE_SHOW';
|
||||||
|
|
||||||
const noOp = () => {};
|
const noOp = () => {};
|
||||||
|
|
||||||
export const fetchAnnouncements = (done = noOp) => (dispatch, getState) => {
|
export const fetchAnnouncements = (done = noOp) => (dispatch) => {
|
||||||
dispatch(fetchAnnouncementsRequest());
|
dispatch(fetchAnnouncementsRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/announcements').then(response => {
|
api().get('/api/v1/announcements').then(response => {
|
||||||
dispatch(fetchAnnouncementsSuccess(response.data.map(x => normalizeAnnouncement(x))));
|
dispatch(fetchAnnouncementsSuccess(response.data.map(x => normalizeAnnouncement(x))));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(fetchAnnouncementsFail(error));
|
dispatch(fetchAnnouncementsFail(error));
|
||||||
|
@ -61,10 +61,10 @@ export const updateAnnouncements = announcement => ({
|
||||||
announcement: normalizeAnnouncement(announcement),
|
announcement: normalizeAnnouncement(announcement),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const dismissAnnouncement = announcementId => (dispatch, getState) => {
|
export const dismissAnnouncement = announcementId => (dispatch) => {
|
||||||
dispatch(dismissAnnouncementRequest(announcementId));
|
dispatch(dismissAnnouncementRequest(announcementId));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/announcements/${announcementId}/dismiss`).then(() => {
|
api().post(`/api/v1/announcements/${announcementId}/dismiss`).then(() => {
|
||||||
dispatch(dismissAnnouncementSuccess(announcementId));
|
dispatch(dismissAnnouncementSuccess(announcementId));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(dismissAnnouncementFail(announcementId, error));
|
dispatch(dismissAnnouncementFail(announcementId, error));
|
||||||
|
@ -103,7 +103,7 @@ export const addReaction = (announcementId, name) => (dispatch, getState) => {
|
||||||
dispatch(addReactionRequest(announcementId, name, alreadyAdded));
|
dispatch(addReactionRequest(announcementId, name, alreadyAdded));
|
||||||
}
|
}
|
||||||
|
|
||||||
api(getState).put(`/api/v1/announcements/${announcementId}/reactions/${encodeURIComponent(name)}`).then(() => {
|
api().put(`/api/v1/announcements/${announcementId}/reactions/${encodeURIComponent(name)}`).then(() => {
|
||||||
dispatch(addReactionSuccess(announcementId, name, alreadyAdded));
|
dispatch(addReactionSuccess(announcementId, name, alreadyAdded));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (!alreadyAdded) {
|
if (!alreadyAdded) {
|
||||||
|
@ -134,10 +134,10 @@ export const addReactionFail = (announcementId, name, error) => ({
|
||||||
skipLoading: true,
|
skipLoading: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const removeReaction = (announcementId, name) => (dispatch, getState) => {
|
export const removeReaction = (announcementId, name) => (dispatch) => {
|
||||||
dispatch(removeReactionRequest(announcementId, name));
|
dispatch(removeReactionRequest(announcementId, name));
|
||||||
|
|
||||||
api(getState).delete(`/api/v1/announcements/${announcementId}/reactions/${encodeURIComponent(name)}`).then(() => {
|
api().delete(`/api/v1/announcements/${announcementId}/reactions/${encodeURIComponent(name)}`).then(() => {
|
||||||
dispatch(removeReactionSuccess(announcementId, name));
|
dispatch(removeReactionSuccess(announcementId, name));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(removeReactionFail(announcementId, name, err));
|
dispatch(removeReactionFail(announcementId, name, err));
|
||||||
|
|
|
@ -13,10 +13,10 @@ export const BLOCKS_EXPAND_SUCCESS = 'BLOCKS_EXPAND_SUCCESS';
|
||||||
export const BLOCKS_EXPAND_FAIL = 'BLOCKS_EXPAND_FAIL';
|
export const BLOCKS_EXPAND_FAIL = 'BLOCKS_EXPAND_FAIL';
|
||||||
|
|
||||||
export function fetchBlocks() {
|
export function fetchBlocks() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchBlocksRequest());
|
dispatch(fetchBlocksRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/blocks').then(response => {
|
api().get('/api/v1/blocks').then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
dispatch(fetchBlocksSuccess(response.data, next ? next.uri : null));
|
dispatch(fetchBlocksSuccess(response.data, next ? next.uri : null));
|
||||||
|
@ -56,7 +56,7 @@ export function expandBlocks() {
|
||||||
|
|
||||||
dispatch(expandBlocksRequest());
|
dispatch(expandBlocksRequest());
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
dispatch(expandBlocksSuccess(response.data, next ? next.uri : null));
|
dispatch(expandBlocksSuccess(response.data, next ? next.uri : null));
|
||||||
|
|
|
@ -18,7 +18,7 @@ export function fetchBookmarkedStatuses() {
|
||||||
|
|
||||||
dispatch(fetchBookmarkedStatusesRequest());
|
dispatch(fetchBookmarkedStatusesRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/bookmarks').then(response => {
|
api().get('/api/v1/bookmarks').then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedStatuses(response.data));
|
dispatch(importFetchedStatuses(response.data));
|
||||||
dispatch(fetchBookmarkedStatusesSuccess(response.data, next ? next.uri : null));
|
dispatch(fetchBookmarkedStatusesSuccess(response.data, next ? next.uri : null));
|
||||||
|
@ -59,7 +59,7 @@ export function expandBookmarkedStatuses() {
|
||||||
|
|
||||||
dispatch(expandBookmarkedStatusesRequest());
|
dispatch(expandBookmarkedStatusesRequest());
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedStatuses(response.data));
|
dispatch(importFetchedStatuses(response.data));
|
||||||
dispatch(expandBookmarkedStatusesSuccess(response.data, next ? next.uri : null));
|
dispatch(expandBookmarkedStatusesSuccess(response.data, next ? next.uri : null));
|
||||||
|
|
|
@ -196,7 +196,7 @@ export function submitCompose(routerHistory) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
api(getState).request({
|
api().request({
|
||||||
url: statusId === null ? '/api/v1/statuses' : `/api/v1/statuses/${statusId}`,
|
url: statusId === null ? '/api/v1/statuses' : `/api/v1/statuses/${statusId}`,
|
||||||
method: statusId === null ? 'post' : 'put',
|
method: statusId === null ? 'post' : 'put',
|
||||||
data: {
|
data: {
|
||||||
|
@ -304,7 +304,7 @@ export function uploadCompose(files) {
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
data.append('file', file);
|
data.append('file', file);
|
||||||
|
|
||||||
api(getState).post('/api/v2/media', data, {
|
api().post('/api/v2/media', data, {
|
||||||
onUploadProgress: function({ loaded }){
|
onUploadProgress: function({ loaded }){
|
||||||
progress[i] = loaded;
|
progress[i] = loaded;
|
||||||
dispatch(uploadComposeProgress(progress.reduce((a, v) => a + v, 0), total));
|
dispatch(uploadComposeProgress(progress.reduce((a, v) => a + v, 0), total));
|
||||||
|
@ -321,7 +321,7 @@ export function uploadCompose(files) {
|
||||||
let tryCount = 1;
|
let tryCount = 1;
|
||||||
|
|
||||||
const poll = () => {
|
const poll = () => {
|
||||||
api(getState).get(`/api/v1/media/${data.id}`).then(response => {
|
api().get(`/api/v1/media/${data.id}`).then(response => {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
dispatch(uploadComposeSuccess(response.data, file));
|
dispatch(uploadComposeSuccess(response.data, file));
|
||||||
} else if (response.status === 206) {
|
} else if (response.status === 206) {
|
||||||
|
@ -343,7 +343,7 @@ export const uploadComposeProcessing = () => ({
|
||||||
type: COMPOSE_UPLOAD_PROCESSING,
|
type: COMPOSE_UPLOAD_PROCESSING,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const uploadThumbnail = (id, file) => (dispatch, getState) => {
|
export const uploadThumbnail = (id, file) => (dispatch) => {
|
||||||
dispatch(uploadThumbnailRequest());
|
dispatch(uploadThumbnailRequest());
|
||||||
|
|
||||||
const total = file.size;
|
const total = file.size;
|
||||||
|
@ -351,7 +351,7 @@ export const uploadThumbnail = (id, file) => (dispatch, getState) => {
|
||||||
|
|
||||||
data.append('thumbnail', file);
|
data.append('thumbnail', file);
|
||||||
|
|
||||||
api(getState).put(`/api/v1/media/${id}`, data, {
|
api().put(`/api/v1/media/${id}`, data, {
|
||||||
onUploadProgress: ({ loaded }) => {
|
onUploadProgress: ({ loaded }) => {
|
||||||
dispatch(uploadThumbnailProgress(loaded, total));
|
dispatch(uploadThumbnailProgress(loaded, total));
|
||||||
},
|
},
|
||||||
|
@ -434,7 +434,7 @@ export function changeUploadCompose(id, params) {
|
||||||
|
|
||||||
dispatch(changeUploadComposeSuccess(data, true));
|
dispatch(changeUploadComposeSuccess(data, true));
|
||||||
} else {
|
} else {
|
||||||
api(getState).put(`/api/v1/media/${id}`, params).then(response => {
|
api().put(`/api/v1/media/${id}`, params).then(response => {
|
||||||
dispatch(changeUploadComposeSuccess(response.data, false));
|
dispatch(changeUploadComposeSuccess(response.data, false));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(changeUploadComposeFail(id, error));
|
dispatch(changeUploadComposeFail(id, error));
|
||||||
|
@ -522,7 +522,7 @@ const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) =>
|
||||||
|
|
||||||
fetchComposeSuggestionsAccountsController = new AbortController();
|
fetchComposeSuggestionsAccountsController = new AbortController();
|
||||||
|
|
||||||
api(getState).get('/api/v1/accounts/search', {
|
api().get('/api/v1/accounts/search', {
|
||||||
signal: fetchComposeSuggestionsAccountsController.signal,
|
signal: fetchComposeSuggestionsAccountsController.signal,
|
||||||
|
|
||||||
params: {
|
params: {
|
||||||
|
@ -556,7 +556,7 @@ const fetchComposeSuggestionsTags = throttle((dispatch, getState, token) => {
|
||||||
|
|
||||||
fetchComposeSuggestionsTagsController = new AbortController();
|
fetchComposeSuggestionsTagsController = new AbortController();
|
||||||
|
|
||||||
api(getState).get('/api/v2/search', {
|
api().get('/api/v2/search', {
|
||||||
signal: fetchComposeSuggestionsTagsController.signal,
|
signal: fetchComposeSuggestionsTagsController.signal,
|
||||||
|
|
||||||
params: {
|
params: {
|
||||||
|
|
|
@ -28,13 +28,13 @@ export const unmountConversations = () => ({
|
||||||
type: CONVERSATIONS_UNMOUNT,
|
type: CONVERSATIONS_UNMOUNT,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const markConversationRead = conversationId => (dispatch, getState) => {
|
export const markConversationRead = conversationId => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: CONVERSATIONS_READ,
|
type: CONVERSATIONS_READ,
|
||||||
id: conversationId,
|
id: conversationId,
|
||||||
});
|
});
|
||||||
|
|
||||||
api(getState).post(`/api/v1/conversations/${conversationId}/read`);
|
api().post(`/api/v1/conversations/${conversationId}/read`);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const expandConversations = ({ maxId } = {}) => (dispatch, getState) => {
|
export const expandConversations = ({ maxId } = {}) => (dispatch, getState) => {
|
||||||
|
@ -48,7 +48,7 @@ export const expandConversations = ({ maxId } = {}) => (dispatch, getState) => {
|
||||||
|
|
||||||
const isLoadingRecent = !!params.since_id;
|
const isLoadingRecent = !!params.since_id;
|
||||||
|
|
||||||
api(getState).get('/api/v1/conversations', { params })
|
api().get('/api/v1/conversations', { params })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ export const updateConversations = conversation => dispatch => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteConversation = conversationId => (dispatch, getState) => {
|
export const deleteConversation = conversationId => (dispatch) => {
|
||||||
dispatch(deleteConversationRequest(conversationId));
|
dispatch(deleteConversationRequest(conversationId));
|
||||||
|
|
||||||
api(getState).delete(`/api/v1/conversations/${conversationId}`)
|
api().delete(`/api/v1/conversations/${conversationId}`)
|
||||||
.then(() => dispatch(deleteConversationSuccess(conversationId)))
|
.then(() => dispatch(deleteConversationSuccess(conversationId)))
|
||||||
.catch(error => dispatch(deleteConversationFail(conversationId, error)));
|
.catch(error => dispatch(deleteConversationFail(conversationId, error)));
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,10 +5,10 @@ export const CUSTOM_EMOJIS_FETCH_SUCCESS = 'CUSTOM_EMOJIS_FETCH_SUCCESS';
|
||||||
export const CUSTOM_EMOJIS_FETCH_FAIL = 'CUSTOM_EMOJIS_FETCH_FAIL';
|
export const CUSTOM_EMOJIS_FETCH_FAIL = 'CUSTOM_EMOJIS_FETCH_FAIL';
|
||||||
|
|
||||||
export function fetchCustomEmojis() {
|
export function fetchCustomEmojis() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchCustomEmojisRequest());
|
dispatch(fetchCustomEmojisRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/custom_emojis').then(response => {
|
api().get('/api/v1/custom_emojis').then(response => {
|
||||||
dispatch(fetchCustomEmojisSuccess(response.data));
|
dispatch(fetchCustomEmojisSuccess(response.data));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(fetchCustomEmojisFail(error));
|
dispatch(fetchCustomEmojisFail(error));
|
||||||
|
|
|
@ -11,10 +11,10 @@ export const DIRECTORY_EXPAND_REQUEST = 'DIRECTORY_EXPAND_REQUEST';
|
||||||
export const DIRECTORY_EXPAND_SUCCESS = 'DIRECTORY_EXPAND_SUCCESS';
|
export const DIRECTORY_EXPAND_SUCCESS = 'DIRECTORY_EXPAND_SUCCESS';
|
||||||
export const DIRECTORY_EXPAND_FAIL = 'DIRECTORY_EXPAND_FAIL';
|
export const DIRECTORY_EXPAND_FAIL = 'DIRECTORY_EXPAND_FAIL';
|
||||||
|
|
||||||
export const fetchDirectory = params => (dispatch, getState) => {
|
export const fetchDirectory = params => (dispatch) => {
|
||||||
dispatch(fetchDirectoryRequest());
|
dispatch(fetchDirectoryRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/directory', { params: { ...params, limit: 20 } }).then(({ data }) => {
|
api().get('/api/v1/directory', { params: { ...params, limit: 20 } }).then(({ data }) => {
|
||||||
dispatch(importFetchedAccounts(data));
|
dispatch(importFetchedAccounts(data));
|
||||||
dispatch(fetchDirectorySuccess(data));
|
dispatch(fetchDirectorySuccess(data));
|
||||||
dispatch(fetchRelationships(data.map(x => x.id)));
|
dispatch(fetchRelationships(data.map(x => x.id)));
|
||||||
|
@ -40,7 +40,7 @@ export const expandDirectory = params => (dispatch, getState) => {
|
||||||
|
|
||||||
const loadedItems = getState().getIn(['user_lists', 'directory', 'items']).size;
|
const loadedItems = getState().getIn(['user_lists', 'directory', 'items']).size;
|
||||||
|
|
||||||
api(getState).get('/api/v1/directory', { params: { ...params, offset: loadedItems, limit: 20 } }).then(({ data }) => {
|
api().get('/api/v1/directory', { params: { ...params, offset: loadedItems, limit: 20 } }).then(({ data }) => {
|
||||||
dispatch(importFetchedAccounts(data));
|
dispatch(importFetchedAccounts(data));
|
||||||
dispatch(expandDirectorySuccess(data));
|
dispatch(expandDirectorySuccess(data));
|
||||||
dispatch(fetchRelationships(data.map(x => x.id)));
|
dispatch(fetchRelationships(data.map(x => x.id)));
|
||||||
|
|
|
@ -24,7 +24,7 @@ export function blockDomain(domain) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch(blockDomainRequest(domain));
|
dispatch(blockDomainRequest(domain));
|
||||||
|
|
||||||
api(getState).post('/api/v1/domain_blocks', { domain }).then(() => {
|
api().post('/api/v1/domain_blocks', { domain }).then(() => {
|
||||||
const at_domain = '@' + domain;
|
const at_domain = '@' + domain;
|
||||||
const accounts = getState().get('accounts').filter(item => item.get('acct').endsWith(at_domain)).valueSeq().map(item => item.get('id'));
|
const accounts = getState().get('accounts').filter(item => item.get('acct').endsWith(at_domain)).valueSeq().map(item => item.get('id'));
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ export function unblockDomain(domain) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch(unblockDomainRequest(domain));
|
dispatch(unblockDomainRequest(domain));
|
||||||
|
|
||||||
api(getState).delete('/api/v1/domain_blocks', { params: { domain } }).then(() => {
|
api().delete('/api/v1/domain_blocks', { params: { domain } }).then(() => {
|
||||||
const at_domain = '@' + domain;
|
const at_domain = '@' + domain;
|
||||||
const accounts = getState().get('accounts').filter(item => item.get('acct').endsWith(at_domain)).valueSeq().map(item => item.get('id'));
|
const accounts = getState().get('accounts').filter(item => item.get('acct').endsWith(at_domain)).valueSeq().map(item => item.get('id'));
|
||||||
dispatch(unblockDomainSuccess({ domain, accounts }));
|
dispatch(unblockDomainSuccess({ domain, accounts }));
|
||||||
|
@ -80,10 +80,10 @@ export function unblockDomainFail(domain, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchDomainBlocks() {
|
export function fetchDomainBlocks() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchDomainBlocksRequest());
|
dispatch(fetchDomainBlocksRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/domain_blocks').then(response => {
|
api().get('/api/v1/domain_blocks').then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(fetchDomainBlocksSuccess(response.data, next ? next.uri : null));
|
dispatch(fetchDomainBlocksSuccess(response.data, next ? next.uri : null));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
@ -123,7 +123,7 @@ export function expandDomainBlocks() {
|
||||||
|
|
||||||
dispatch(expandDomainBlocksRequest());
|
dispatch(expandDomainBlocksRequest());
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(expandDomainBlocksSuccess(response.data, next ? next.uri : null));
|
dispatch(expandDomainBlocksSuccess(response.data, next ? next.uri : null));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|
|
@ -18,7 +18,7 @@ export function fetchFavouritedStatuses() {
|
||||||
|
|
||||||
dispatch(fetchFavouritedStatusesRequest());
|
dispatch(fetchFavouritedStatusesRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/favourites').then(response => {
|
api().get('/api/v1/favourites').then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedStatuses(response.data));
|
dispatch(importFetchedStatuses(response.data));
|
||||||
dispatch(fetchFavouritedStatusesSuccess(response.data, next ? next.uri : null));
|
dispatch(fetchFavouritedStatusesSuccess(response.data, next ? next.uri : null));
|
||||||
|
@ -62,7 +62,7 @@ export function expandFavouritedStatuses() {
|
||||||
|
|
||||||
dispatch(expandFavouritedStatusesRequest());
|
dispatch(expandFavouritedStatusesRequest());
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedStatuses(response.data));
|
dispatch(importFetchedStatuses(response.data));
|
||||||
dispatch(expandFavouritedStatusesSuccess(response.data, next ? next.uri : null));
|
dispatch(expandFavouritedStatusesSuccess(response.data, next ? next.uri : null));
|
||||||
|
|
|
@ -11,7 +11,7 @@ export const fetchFeaturedTags = (id) => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchFeaturedTagsRequest(id));
|
dispatch(fetchFeaturedTagsRequest(id));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/accounts/${id}/featured_tags`)
|
api().get(`/api/v1/accounts/${id}/featured_tags`)
|
||||||
.then(({ data }) => dispatch(fetchFeaturedTagsSuccess(id, data)))
|
.then(({ data }) => dispatch(fetchFeaturedTagsSuccess(id, data)))
|
||||||
.catch(err => dispatch(fetchFeaturedTagsFail(id, err)));
|
.catch(err => dispatch(fetchFeaturedTagsFail(id, err)));
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,13 +23,13 @@ export const initAddFilter = (status, { contextType }) => dispatch =>
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const fetchFilters = () => (dispatch, getState) => {
|
export const fetchFilters = () => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: FILTERS_FETCH_REQUEST,
|
type: FILTERS_FETCH_REQUEST,
|
||||||
skipLoading: true,
|
skipLoading: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
api(getState)
|
api()
|
||||||
.get('/api/v2/filters')
|
.get('/api/v2/filters')
|
||||||
.then(({ data }) => dispatch({
|
.then(({ data }) => dispatch({
|
||||||
type: FILTERS_FETCH_SUCCESS,
|
type: FILTERS_FETCH_SUCCESS,
|
||||||
|
@ -44,10 +44,10 @@ export const fetchFilters = () => (dispatch, getState) => {
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createFilterStatus = (params, onSuccess, onFail) => (dispatch, getState) => {
|
export const createFilterStatus = (params, onSuccess, onFail) => (dispatch) => {
|
||||||
dispatch(createFilterStatusRequest());
|
dispatch(createFilterStatusRequest());
|
||||||
|
|
||||||
api(getState).post(`/api/v2/filters/${params.filter_id}/statuses`, params).then(response => {
|
api().post(`/api/v2/filters/${params.filter_id}/statuses`, params).then(response => {
|
||||||
dispatch(createFilterStatusSuccess(response.data));
|
dispatch(createFilterStatusSuccess(response.data));
|
||||||
if (onSuccess) onSuccess();
|
if (onSuccess) onSuccess();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -70,10 +70,10 @@ export const createFilterStatusFail = error => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const createFilter = (params, onSuccess, onFail) => (dispatch, getState) => {
|
export const createFilter = (params, onSuccess, onFail) => (dispatch) => {
|
||||||
dispatch(createFilterRequest());
|
dispatch(createFilterRequest());
|
||||||
|
|
||||||
api(getState).post('/api/v2/filters', params).then(response => {
|
api().post('/api/v2/filters', params).then(response => {
|
||||||
dispatch(createFilterSuccess(response.data));
|
dispatch(createFilterSuccess(response.data));
|
||||||
if (onSuccess) onSuccess(response.data);
|
if (onSuccess) onSuccess(response.data);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
|
@ -15,7 +15,7 @@ export const fetchHistory = statusId => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchHistoryRequest(statusId));
|
dispatch(fetchHistoryRequest(statusId));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/statuses/${statusId}/history`).then(({ data }) => {
|
api().get(`/api/v1/statuses/${statusId}/history`).then(({ data }) => {
|
||||||
dispatch(importFetchedAccounts(data.map(x => x.account)));
|
dispatch(importFetchedAccounts(data.map(x => x.account)));
|
||||||
dispatch(fetchHistorySuccess(statusId, data));
|
dispatch(fetchHistorySuccess(statusId, data));
|
||||||
}).catch(error => dispatch(fetchHistoryFail(error)));
|
}).catch(error => dispatch(fetchHistoryFail(error)));
|
||||||
|
|
|
@ -3,10 +3,6 @@ import api, { getLinks } from '../api';
|
||||||
import { fetchRelationships } from './accounts';
|
import { fetchRelationships } from './accounts';
|
||||||
import { importFetchedAccounts, importFetchedStatus } from './importer';
|
import { importFetchedAccounts, importFetchedStatus } from './importer';
|
||||||
|
|
||||||
export const REBLOG_REQUEST = 'REBLOG_REQUEST';
|
|
||||||
export const REBLOG_SUCCESS = 'REBLOG_SUCCESS';
|
|
||||||
export const REBLOG_FAIL = 'REBLOG_FAIL';
|
|
||||||
|
|
||||||
export const REBLOGS_EXPAND_REQUEST = 'REBLOGS_EXPAND_REQUEST';
|
export const REBLOGS_EXPAND_REQUEST = 'REBLOGS_EXPAND_REQUEST';
|
||||||
export const REBLOGS_EXPAND_SUCCESS = 'REBLOGS_EXPAND_SUCCESS';
|
export const REBLOGS_EXPAND_SUCCESS = 'REBLOGS_EXPAND_SUCCESS';
|
||||||
export const REBLOGS_EXPAND_FAIL = 'REBLOGS_EXPAND_FAIL';
|
export const REBLOGS_EXPAND_FAIL = 'REBLOGS_EXPAND_FAIL';
|
||||||
|
@ -15,10 +11,6 @@ export const FAVOURITE_REQUEST = 'FAVOURITE_REQUEST';
|
||||||
export const FAVOURITE_SUCCESS = 'FAVOURITE_SUCCESS';
|
export const FAVOURITE_SUCCESS = 'FAVOURITE_SUCCESS';
|
||||||
export const FAVOURITE_FAIL = 'FAVOURITE_FAIL';
|
export const FAVOURITE_FAIL = 'FAVOURITE_FAIL';
|
||||||
|
|
||||||
export const UNREBLOG_REQUEST = 'UNREBLOG_REQUEST';
|
|
||||||
export const UNREBLOG_SUCCESS = 'UNREBLOG_SUCCESS';
|
|
||||||
export const UNREBLOG_FAIL = 'UNREBLOG_FAIL';
|
|
||||||
|
|
||||||
export const UNFAVOURITE_REQUEST = 'UNFAVOURITE_REQUEST';
|
export const UNFAVOURITE_REQUEST = 'UNFAVOURITE_REQUEST';
|
||||||
export const UNFAVOURITE_SUCCESS = 'UNFAVOURITE_SUCCESS';
|
export const UNFAVOURITE_SUCCESS = 'UNFAVOURITE_SUCCESS';
|
||||||
export const UNFAVOURITE_FAIL = 'UNFAVOURITE_FAIL';
|
export const UNFAVOURITE_FAIL = 'UNFAVOURITE_FAIL';
|
||||||
|
@ -51,89 +43,13 @@ export const UNBOOKMARK_REQUEST = 'UNBOOKMARKED_REQUEST';
|
||||||
export const UNBOOKMARK_SUCCESS = 'UNBOOKMARKED_SUCCESS';
|
export const UNBOOKMARK_SUCCESS = 'UNBOOKMARKED_SUCCESS';
|
||||||
export const UNBOOKMARK_FAIL = 'UNBOOKMARKED_FAIL';
|
export const UNBOOKMARK_FAIL = 'UNBOOKMARKED_FAIL';
|
||||||
|
|
||||||
export function reblog(status, visibility) {
|
export * from "./interactions_typed";
|
||||||
return function (dispatch, getState) {
|
|
||||||
dispatch(reblogRequest(status));
|
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${status.get('id')}/reblog`, { visibility }).then(function (response) {
|
|
||||||
// The reblog API method returns a new status wrapped around the original. In this case we are only
|
|
||||||
// interested in how the original is modified, hence passing it skipping the wrapper
|
|
||||||
dispatch(importFetchedStatus(response.data.reblog));
|
|
||||||
dispatch(reblogSuccess(status));
|
|
||||||
}).catch(function (error) {
|
|
||||||
dispatch(reblogFail(status, error));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function unreblog(status) {
|
|
||||||
return (dispatch, getState) => {
|
|
||||||
dispatch(unreblogRequest(status));
|
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${status.get('id')}/unreblog`).then(response => {
|
|
||||||
dispatch(importFetchedStatus(response.data));
|
|
||||||
dispatch(unreblogSuccess(status));
|
|
||||||
}).catch(error => {
|
|
||||||
dispatch(unreblogFail(status, error));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function reblogRequest(status) {
|
|
||||||
return {
|
|
||||||
type: REBLOG_REQUEST,
|
|
||||||
status: status,
|
|
||||||
skipLoading: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function reblogSuccess(status) {
|
|
||||||
return {
|
|
||||||
type: REBLOG_SUCCESS,
|
|
||||||
status: status,
|
|
||||||
skipLoading: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function reblogFail(status, error) {
|
|
||||||
return {
|
|
||||||
type: REBLOG_FAIL,
|
|
||||||
status: status,
|
|
||||||
error: error,
|
|
||||||
skipLoading: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function unreblogRequest(status) {
|
|
||||||
return {
|
|
||||||
type: UNREBLOG_REQUEST,
|
|
||||||
status: status,
|
|
||||||
skipLoading: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function unreblogSuccess(status) {
|
|
||||||
return {
|
|
||||||
type: UNREBLOG_SUCCESS,
|
|
||||||
status: status,
|
|
||||||
skipLoading: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function unreblogFail(status, error) {
|
|
||||||
return {
|
|
||||||
type: UNREBLOG_FAIL,
|
|
||||||
status: status,
|
|
||||||
error: error,
|
|
||||||
skipLoading: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function favourite(status) {
|
export function favourite(status) {
|
||||||
return function (dispatch, getState) {
|
return function (dispatch) {
|
||||||
dispatch(favouriteRequest(status));
|
dispatch(favouriteRequest(status));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${status.get('id')}/favourite`).then(function (response) {
|
api().post(`/api/v1/statuses/${status.get('id')}/favourite`).then(function (response) {
|
||||||
dispatch(importFetchedStatus(response.data));
|
dispatch(importFetchedStatus(response.data));
|
||||||
dispatch(favouriteSuccess(status));
|
dispatch(favouriteSuccess(status));
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
|
@ -143,10 +59,10 @@ export function favourite(status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unfavourite(status) {
|
export function unfavourite(status) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(unfavouriteRequest(status));
|
dispatch(unfavouriteRequest(status));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${status.get('id')}/unfavourite`).then(response => {
|
api().post(`/api/v1/statuses/${status.get('id')}/unfavourite`).then(response => {
|
||||||
dispatch(importFetchedStatus(response.data));
|
dispatch(importFetchedStatus(response.data));
|
||||||
dispatch(unfavouriteSuccess(status));
|
dispatch(unfavouriteSuccess(status));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -206,10 +122,10 @@ export function unfavouriteFail(status, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function bookmark(status) {
|
export function bookmark(status) {
|
||||||
return function (dispatch, getState) {
|
return function (dispatch) {
|
||||||
dispatch(bookmarkRequest(status));
|
dispatch(bookmarkRequest(status));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${status.get('id')}/bookmark`).then(function (response) {
|
api().post(`/api/v1/statuses/${status.get('id')}/bookmark`).then(function (response) {
|
||||||
dispatch(importFetchedStatus(response.data));
|
dispatch(importFetchedStatus(response.data));
|
||||||
dispatch(bookmarkSuccess(status, response.data));
|
dispatch(bookmarkSuccess(status, response.data));
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
|
@ -219,10 +135,10 @@ export function bookmark(status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unbookmark(status) {
|
export function unbookmark(status) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(unbookmarkRequest(status));
|
dispatch(unbookmarkRequest(status));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${status.get('id')}/unbookmark`).then(response => {
|
api().post(`/api/v1/statuses/${status.get('id')}/unbookmark`).then(response => {
|
||||||
dispatch(importFetchedStatus(response.data));
|
dispatch(importFetchedStatus(response.data));
|
||||||
dispatch(unbookmarkSuccess(status, response.data));
|
dispatch(unbookmarkSuccess(status, response.data));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -278,10 +194,10 @@ export function unbookmarkFail(status, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchReblogs(id) {
|
export function fetchReblogs(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchReblogsRequest(id));
|
dispatch(fetchReblogsRequest(id));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/statuses/${id}/reblogged_by`).then(response => {
|
api().get(`/api/v1/statuses/${id}/reblogged_by`).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
dispatch(fetchReblogsSuccess(id, response.data, next ? next.uri : null));
|
dispatch(fetchReblogsSuccess(id, response.data, next ? next.uri : null));
|
||||||
|
@ -325,7 +241,7 @@ export function expandReblogs(id) {
|
||||||
|
|
||||||
dispatch(expandReblogsRequest(id));
|
dispatch(expandReblogsRequest(id));
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
|
@ -360,10 +276,10 @@ export function expandReblogsFail(id, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchFavourites(id) {
|
export function fetchFavourites(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchFavouritesRequest(id));
|
dispatch(fetchFavouritesRequest(id));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/statuses/${id}/favourited_by`).then(response => {
|
api().get(`/api/v1/statuses/${id}/favourited_by`).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
dispatch(fetchFavouritesSuccess(id, response.data, next ? next.uri : null));
|
dispatch(fetchFavouritesSuccess(id, response.data, next ? next.uri : null));
|
||||||
|
@ -407,7 +323,7 @@ export function expandFavourites(id) {
|
||||||
|
|
||||||
dispatch(expandFavouritesRequest(id));
|
dispatch(expandFavouritesRequest(id));
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
|
@ -442,10 +358,10 @@ export function expandFavouritesFail(id, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pin(status) {
|
export function pin(status) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(pinRequest(status));
|
dispatch(pinRequest(status));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${status.get('id')}/pin`).then(response => {
|
api().post(`/api/v1/statuses/${status.get('id')}/pin`).then(response => {
|
||||||
dispatch(importFetchedStatus(response.data));
|
dispatch(importFetchedStatus(response.data));
|
||||||
dispatch(pinSuccess(status));
|
dispatch(pinSuccess(status));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -480,10 +396,10 @@ export function pinFail(status, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unpin (status) {
|
export function unpin (status) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(unpinRequest(status));
|
dispatch(unpinRequest(status));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${status.get('id')}/unpin`).then(response => {
|
api().post(`/api/v1/statuses/${status.get('id')}/unpin`).then(response => {
|
||||||
dispatch(importFetchedStatus(response.data));
|
dispatch(importFetchedStatus(response.data));
|
||||||
dispatch(unpinSuccess(status));
|
dispatch(unpinSuccess(status));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
35
app/javascript/mastodon/actions/interactions_typed.ts
Normal file
35
app/javascript/mastodon/actions/interactions_typed.ts
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import { apiReblog, apiUnreblog } from 'mastodon/api/interactions';
|
||||||
|
import type { StatusVisibility } from 'mastodon/models/status';
|
||||||
|
import { createDataLoadingThunk } from 'mastodon/store/typed_functions';
|
||||||
|
|
||||||
|
import { importFetchedStatus } from './importer';
|
||||||
|
|
||||||
|
export const reblog = createDataLoadingThunk(
|
||||||
|
'status/reblog',
|
||||||
|
({
|
||||||
|
statusId,
|
||||||
|
visibility,
|
||||||
|
}: {
|
||||||
|
statusId: string;
|
||||||
|
visibility: StatusVisibility;
|
||||||
|
}) => apiReblog(statusId, visibility),
|
||||||
|
(data, { dispatch, discardLoadData }) => {
|
||||||
|
// The reblog API method returns a new status wrapped around the original. In this case we are only
|
||||||
|
// interested in how the original is modified, hence passing it skipping the wrapper
|
||||||
|
dispatch(importFetchedStatus(data.reblog));
|
||||||
|
|
||||||
|
// The payload is not used in any actions
|
||||||
|
return discardLoadData;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
export const unreblog = createDataLoadingThunk(
|
||||||
|
'status/unreblog',
|
||||||
|
({ statusId }: { statusId: string }) => apiUnreblog(statusId),
|
||||||
|
(data, { dispatch, discardLoadData }) => {
|
||||||
|
dispatch(importFetchedStatus(data));
|
||||||
|
|
||||||
|
// The payload is not used in any actions
|
||||||
|
return discardLoadData;
|
||||||
|
},
|
||||||
|
);
|
|
@ -57,7 +57,7 @@ export const fetchList = id => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchListRequest(id));
|
dispatch(fetchListRequest(id));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/lists/${id}`)
|
api().get(`/api/v1/lists/${id}`)
|
||||||
.then(({ data }) => dispatch(fetchListSuccess(data)))
|
.then(({ data }) => dispatch(fetchListSuccess(data)))
|
||||||
.catch(err => dispatch(fetchListFail(id, err)));
|
.catch(err => dispatch(fetchListFail(id, err)));
|
||||||
};
|
};
|
||||||
|
@ -78,10 +78,10 @@ export const fetchListFail = (id, error) => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchLists = () => (dispatch, getState) => {
|
export const fetchLists = () => (dispatch) => {
|
||||||
dispatch(fetchListsRequest());
|
dispatch(fetchListsRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/lists')
|
api().get('/api/v1/lists')
|
||||||
.then(({ data }) => dispatch(fetchListsSuccess(data)))
|
.then(({ data }) => dispatch(fetchListsSuccess(data)))
|
||||||
.catch(err => dispatch(fetchListsFail(err)));
|
.catch(err => dispatch(fetchListsFail(err)));
|
||||||
};
|
};
|
||||||
|
@ -125,10 +125,10 @@ export const changeListEditorTitle = value => ({
|
||||||
value,
|
value,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const createList = (title, shouldReset) => (dispatch, getState) => {
|
export const createList = (title, shouldReset) => (dispatch) => {
|
||||||
dispatch(createListRequest());
|
dispatch(createListRequest());
|
||||||
|
|
||||||
api(getState).post('/api/v1/lists', { title }).then(({ data }) => {
|
api().post('/api/v1/lists', { title }).then(({ data }) => {
|
||||||
dispatch(createListSuccess(data));
|
dispatch(createListSuccess(data));
|
||||||
|
|
||||||
if (shouldReset) {
|
if (shouldReset) {
|
||||||
|
@ -151,10 +151,10 @@ export const createListFail = error => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updateList = (id, title, shouldReset, isExclusive, replies_policy) => (dispatch, getState) => {
|
export const updateList = (id, title, shouldReset, isExclusive, replies_policy) => (dispatch) => {
|
||||||
dispatch(updateListRequest(id));
|
dispatch(updateListRequest(id));
|
||||||
|
|
||||||
api(getState).put(`/api/v1/lists/${id}`, { title, replies_policy, exclusive: typeof isExclusive === 'undefined' ? undefined : !!isExclusive }).then(({ data }) => {
|
api().put(`/api/v1/lists/${id}`, { title, replies_policy, exclusive: typeof isExclusive === 'undefined' ? undefined : !!isExclusive }).then(({ data }) => {
|
||||||
dispatch(updateListSuccess(data));
|
dispatch(updateListSuccess(data));
|
||||||
|
|
||||||
if (shouldReset) {
|
if (shouldReset) {
|
||||||
|
@ -183,10 +183,10 @@ export const resetListEditor = () => ({
|
||||||
type: LIST_EDITOR_RESET,
|
type: LIST_EDITOR_RESET,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const deleteList = id => (dispatch, getState) => {
|
export const deleteList = id => (dispatch) => {
|
||||||
dispatch(deleteListRequest(id));
|
dispatch(deleteListRequest(id));
|
||||||
|
|
||||||
api(getState).delete(`/api/v1/lists/${id}`)
|
api().delete(`/api/v1/lists/${id}`)
|
||||||
.then(() => dispatch(deleteListSuccess(id)))
|
.then(() => dispatch(deleteListSuccess(id)))
|
||||||
.catch(err => dispatch(deleteListFail(id, err)));
|
.catch(err => dispatch(deleteListFail(id, err)));
|
||||||
};
|
};
|
||||||
|
@ -207,10 +207,10 @@ export const deleteListFail = (id, error) => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchListAccounts = listId => (dispatch, getState) => {
|
export const fetchListAccounts = listId => (dispatch) => {
|
||||||
dispatch(fetchListAccountsRequest(listId));
|
dispatch(fetchListAccountsRequest(listId));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/lists/${listId}/accounts`, { params: { limit: 0 } }).then(({ data }) => {
|
api().get(`/api/v1/lists/${listId}/accounts`, { params: { limit: 0 } }).then(({ data }) => {
|
||||||
dispatch(importFetchedAccounts(data));
|
dispatch(importFetchedAccounts(data));
|
||||||
dispatch(fetchListAccountsSuccess(listId, data));
|
dispatch(fetchListAccountsSuccess(listId, data));
|
||||||
}).catch(err => dispatch(fetchListAccountsFail(listId, err)));
|
}).catch(err => dispatch(fetchListAccountsFail(listId, err)));
|
||||||
|
@ -234,7 +234,7 @@ export const fetchListAccountsFail = (id, error) => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchListSuggestions = q => (dispatch, getState) => {
|
export const fetchListSuggestions = q => (dispatch) => {
|
||||||
const params = {
|
const params = {
|
||||||
q,
|
q,
|
||||||
resolve: false,
|
resolve: false,
|
||||||
|
@ -242,7 +242,7 @@ export const fetchListSuggestions = q => (dispatch, getState) => {
|
||||||
following: true,
|
following: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
api(getState).get('/api/v1/accounts/search', { params }).then(({ data }) => {
|
api().get('/api/v1/accounts/search', { params }).then(({ data }) => {
|
||||||
dispatch(importFetchedAccounts(data));
|
dispatch(importFetchedAccounts(data));
|
||||||
dispatch(fetchListSuggestionsReady(q, data));
|
dispatch(fetchListSuggestionsReady(q, data));
|
||||||
}).catch(error => dispatch(showAlertForError(error)));
|
}).catch(error => dispatch(showAlertForError(error)));
|
||||||
|
@ -267,10 +267,10 @@ export const addToListEditor = accountId => (dispatch, getState) => {
|
||||||
dispatch(addToList(getState().getIn(['listEditor', 'listId']), accountId));
|
dispatch(addToList(getState().getIn(['listEditor', 'listId']), accountId));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addToList = (listId, accountId) => (dispatch, getState) => {
|
export const addToList = (listId, accountId) => (dispatch) => {
|
||||||
dispatch(addToListRequest(listId, accountId));
|
dispatch(addToListRequest(listId, accountId));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/lists/${listId}/accounts`, { account_ids: [accountId] })
|
api().post(`/api/v1/lists/${listId}/accounts`, { account_ids: [accountId] })
|
||||||
.then(() => dispatch(addToListSuccess(listId, accountId)))
|
.then(() => dispatch(addToListSuccess(listId, accountId)))
|
||||||
.catch(err => dispatch(addToListFail(listId, accountId, err)));
|
.catch(err => dispatch(addToListFail(listId, accountId, err)));
|
||||||
};
|
};
|
||||||
|
@ -298,10 +298,10 @@ export const removeFromListEditor = accountId => (dispatch, getState) => {
|
||||||
dispatch(removeFromList(getState().getIn(['listEditor', 'listId']), accountId));
|
dispatch(removeFromList(getState().getIn(['listEditor', 'listId']), accountId));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const removeFromList = (listId, accountId) => (dispatch, getState) => {
|
export const removeFromList = (listId, accountId) => (dispatch) => {
|
||||||
dispatch(removeFromListRequest(listId, accountId));
|
dispatch(removeFromListRequest(listId, accountId));
|
||||||
|
|
||||||
api(getState).delete(`/api/v1/lists/${listId}/accounts`, { params: { account_ids: [accountId] } })
|
api().delete(`/api/v1/lists/${listId}/accounts`, { params: { account_ids: [accountId] } })
|
||||||
.then(() => dispatch(removeFromListSuccess(listId, accountId)))
|
.then(() => dispatch(removeFromListSuccess(listId, accountId)))
|
||||||
.catch(err => dispatch(removeFromListFail(listId, accountId, err)));
|
.catch(err => dispatch(removeFromListFail(listId, accountId, err)));
|
||||||
};
|
};
|
||||||
|
@ -338,10 +338,10 @@ export const setupListAdder = accountId => (dispatch, getState) => {
|
||||||
dispatch(fetchAccountLists(accountId));
|
dispatch(fetchAccountLists(accountId));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fetchAccountLists = accountId => (dispatch, getState) => {
|
export const fetchAccountLists = accountId => (dispatch) => {
|
||||||
dispatch(fetchAccountListsRequest(accountId));
|
dispatch(fetchAccountListsRequest(accountId));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/accounts/${accountId}/lists`)
|
api().get(`/api/v1/accounts/${accountId}/lists`)
|
||||||
.then(({ data }) => dispatch(fetchAccountListsSuccess(accountId, data)))
|
.then(({ data }) => dispatch(fetchAccountListsSuccess(accountId, data)))
|
||||||
.catch(err => dispatch(fetchAccountListsFail(accountId, err)));
|
.catch(err => dispatch(fetchAccountListsFail(accountId, err)));
|
||||||
};
|
};
|
||||||
|
@ -370,4 +370,3 @@ export const addToListAdder = listId => (dispatch, getState) => {
|
||||||
export const removeFromListAdder = listId => (dispatch, getState) => {
|
export const removeFromListAdder = listId => (dispatch, getState) => {
|
||||||
dispatch(removeFromList(listId, getState().getIn(['listAdder', 'accountId'])));
|
dispatch(removeFromList(listId, getState().getIn(['listAdder', 'accountId'])));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
|
|
||||||
import type { MarkerJSON } from 'mastodon/api_types/markers';
|
import type { MarkerJSON } from 'mastodon/api_types/markers';
|
||||||
|
import { getAccessToken } from 'mastodon/initial_state';
|
||||||
import type { AppDispatch, RootState } from 'mastodon/store';
|
import type { AppDispatch, RootState } from 'mastodon/store';
|
||||||
import { createAppAsyncThunk } from 'mastodon/store/typed_functions';
|
import { createAppAsyncThunk } from 'mastodon/store/typed_functions';
|
||||||
|
|
||||||
import api, { authorizationTokenFromState } from '../api';
|
import api from '../api';
|
||||||
import { compareId } from '../compare_id';
|
import { compareId } from '../compare_id';
|
||||||
|
|
||||||
export const synchronouslySubmitMarkers = createAppAsyncThunk(
|
export const synchronouslySubmitMarkers = createAppAsyncThunk(
|
||||||
'markers/submit',
|
'markers/submit',
|
||||||
async (_args, { getState }) => {
|
async (_args, { getState }) => {
|
||||||
const accessToken = authorizationTokenFromState(getState);
|
const accessToken = getAccessToken();
|
||||||
const params = buildPostMarkersParams(getState());
|
const params = buildPostMarkersParams(getState());
|
||||||
|
|
||||||
if (Object.keys(params).length === 0 || !accessToken) {
|
if (
|
||||||
|
Object.keys(params).length === 0 ||
|
||||||
|
!accessToken ||
|
||||||
|
accessToken === ''
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,14 +101,14 @@ export const submitMarkersAction = createAppAsyncThunk<{
|
||||||
home: string | undefined;
|
home: string | undefined;
|
||||||
notifications: string | undefined;
|
notifications: string | undefined;
|
||||||
}>('markers/submitAction', async (_args, { getState }) => {
|
}>('markers/submitAction', async (_args, { getState }) => {
|
||||||
const accessToken = authorizationTokenFromState(getState);
|
const accessToken = getAccessToken();
|
||||||
const params = buildPostMarkersParams(getState());
|
const params = buildPostMarkersParams(getState());
|
||||||
|
|
||||||
if (Object.keys(params).length === 0 || accessToken === '') {
|
if (Object.keys(params).length === 0 || !accessToken || accessToken === '') {
|
||||||
return { home: undefined, notifications: undefined };
|
return { home: undefined, notifications: undefined };
|
||||||
}
|
}
|
||||||
|
|
||||||
await api(getState).post<MarkerJSON>('/api/v1/markers', params);
|
await api().post<MarkerJSON>('/api/v1/markers', params);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
home: params.home?.last_read_id,
|
home: params.home?.last_read_id,
|
||||||
|
@ -133,14 +138,11 @@ export const submitMarkers = createAppAsyncThunk(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
export const fetchMarkers = createAppAsyncThunk(
|
export const fetchMarkers = createAppAsyncThunk('markers/fetch', async () => {
|
||||||
'markers/fetch',
|
const response = await api().get<Record<string, MarkerJSON>>(
|
||||||
async (_args, { getState }) => {
|
`/api/v1/markers`,
|
||||||
const response = await api(getState).get<Record<string, MarkerJSON>>(
|
{ params: { timeline: ['notifications'] } },
|
||||||
`/api/v1/markers`,
|
);
|
||||||
{ params: { timeline: ['notifications'] } },
|
|
||||||
);
|
|
||||||
|
|
||||||
return { markers: response.data };
|
return { markers: response.data };
|
||||||
},
|
});
|
||||||
);
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ export const MUTES_EXPAND_SUCCESS = 'MUTES_EXPAND_SUCCESS';
|
||||||
export const MUTES_EXPAND_FAIL = 'MUTES_EXPAND_FAIL';
|
export const MUTES_EXPAND_FAIL = 'MUTES_EXPAND_FAIL';
|
||||||
|
|
||||||
export function fetchMutes() {
|
export function fetchMutes() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchMutesRequest());
|
dispatch(fetchMutesRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/mutes').then(response => {
|
api().get('/api/v1/mutes').then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
dispatch(fetchMutesSuccess(response.data, next ? next.uri : null));
|
dispatch(fetchMutesSuccess(response.data, next ? next.uri : null));
|
||||||
|
@ -56,7 +56,7 @@ export function expandMutes() {
|
||||||
|
|
||||||
dispatch(expandMutesRequest());
|
dispatch(expandMutesRequest());
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data));
|
dispatch(importFetchedAccounts(response.data));
|
||||||
dispatch(expandMutesSuccess(response.data, next ? next.uri : null));
|
dispatch(expandMutesSuccess(response.data, next ? next.uri : null));
|
||||||
|
|
|
@ -216,7 +216,7 @@ export function expandNotifications({ maxId, forceLoad } = {}, done = noOp) {
|
||||||
|
|
||||||
dispatch(expandNotificationsRequest(isLoadingMore));
|
dispatch(expandNotificationsRequest(isLoadingMore));
|
||||||
|
|
||||||
api(getState).get('/api/v1/notifications', { params, signal: expandNotificationsController.signal }).then(response => {
|
api().get('/api/v1/notifications', { params, signal: expandNotificationsController.signal }).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
||||||
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
|
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
|
||||||
|
@ -262,12 +262,12 @@ export function expandNotificationsFail(error, isLoadingMore) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function clearNotifications() {
|
export function clearNotifications() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: NOTIFICATIONS_CLEAR,
|
type: NOTIFICATIONS_CLEAR,
|
||||||
});
|
});
|
||||||
|
|
||||||
api(getState).post('/api/v1/notifications/clear');
|
api().post('/api/v1/notifications/clear');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,10 +346,10 @@ export function setBrowserPermission (value) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fetchNotificationPolicy = () => (dispatch, getState) => {
|
export const fetchNotificationPolicy = () => (dispatch) => {
|
||||||
dispatch(fetchNotificationPolicyRequest());
|
dispatch(fetchNotificationPolicyRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/notifications/policy').then(({ data }) => {
|
api().get('/api/v1/notifications/policy').then(({ data }) => {
|
||||||
dispatch(fetchNotificationPolicySuccess(data));
|
dispatch(fetchNotificationPolicySuccess(data));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(fetchNotificationPolicyFail(err));
|
dispatch(fetchNotificationPolicyFail(err));
|
||||||
|
@ -370,10 +370,10 @@ export const fetchNotificationPolicyFail = error => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const updateNotificationsPolicy = params => (dispatch, getState) => {
|
export const updateNotificationsPolicy = params => (dispatch) => {
|
||||||
dispatch(fetchNotificationPolicyRequest());
|
dispatch(fetchNotificationPolicyRequest());
|
||||||
|
|
||||||
api(getState).put('/api/v1/notifications/policy', params).then(({ data }) => {
|
api().put('/api/v1/notifications/policy', params).then(({ data }) => {
|
||||||
dispatch(fetchNotificationPolicySuccess(data));
|
dispatch(fetchNotificationPolicySuccess(data));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(fetchNotificationPolicyFail(err));
|
dispatch(fetchNotificationPolicyFail(err));
|
||||||
|
@ -393,7 +393,7 @@ export const fetchNotificationRequests = () => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchNotificationRequestsRequest());
|
dispatch(fetchNotificationRequestsRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/notifications/requests', { params }).then(response => {
|
api().get('/api/v1/notifications/requests', { params }).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data.map(x => x.account)));
|
dispatch(importFetchedAccounts(response.data.map(x => x.account)));
|
||||||
dispatch(fetchNotificationRequestsSuccess(response.data, next ? next.uri : null));
|
dispatch(fetchNotificationRequestsSuccess(response.data, next ? next.uri : null));
|
||||||
|
@ -426,7 +426,7 @@ export const expandNotificationRequests = () => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(expandNotificationRequestsRequest());
|
dispatch(expandNotificationRequestsRequest());
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data.map(x => x.account)));
|
dispatch(importFetchedAccounts(response.data.map(x => x.account)));
|
||||||
dispatch(expandNotificationRequestsSuccess(response.data, next?.uri));
|
dispatch(expandNotificationRequestsSuccess(response.data, next?.uri));
|
||||||
|
@ -459,7 +459,7 @@ export const fetchNotificationRequest = id => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchNotificationRequestRequest(id));
|
dispatch(fetchNotificationRequestRequest(id));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/notifications/requests/${id}`).then(({ data }) => {
|
api().get(`/api/v1/notifications/requests/${id}`).then(({ data }) => {
|
||||||
dispatch(fetchNotificationRequestSuccess(data));
|
dispatch(fetchNotificationRequestSuccess(data));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(fetchNotificationRequestFail(id, err));
|
dispatch(fetchNotificationRequestFail(id, err));
|
||||||
|
@ -482,10 +482,10 @@ export const fetchNotificationRequestFail = (id, error) => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const acceptNotificationRequest = id => (dispatch, getState) => {
|
export const acceptNotificationRequest = id => (dispatch) => {
|
||||||
dispatch(acceptNotificationRequestRequest(id));
|
dispatch(acceptNotificationRequestRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/notifications/requests/${id}/accept`).then(() => {
|
api().post(`/api/v1/notifications/requests/${id}/accept`).then(() => {
|
||||||
dispatch(acceptNotificationRequestSuccess(id));
|
dispatch(acceptNotificationRequestSuccess(id));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(acceptNotificationRequestFail(id, err));
|
dispatch(acceptNotificationRequestFail(id, err));
|
||||||
|
@ -508,10 +508,10 @@ export const acceptNotificationRequestFail = (id, error) => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const dismissNotificationRequest = id => (dispatch, getState) => {
|
export const dismissNotificationRequest = id => (dispatch) => {
|
||||||
dispatch(dismissNotificationRequestRequest(id));
|
dispatch(dismissNotificationRequestRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/notifications/requests/${id}/dismiss`).then(() =>{
|
api().post(`/api/v1/notifications/requests/${id}/dismiss`).then(() =>{
|
||||||
dispatch(dismissNotificationRequestSuccess(id));
|
dispatch(dismissNotificationRequestSuccess(id));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(dismissNotificationRequestFail(id, err));
|
dispatch(dismissNotificationRequestFail(id, err));
|
||||||
|
@ -550,7 +550,7 @@ export const fetchNotificationsForRequest = accountId => (dispatch, getState) =>
|
||||||
|
|
||||||
dispatch(fetchNotificationsForRequestRequest());
|
dispatch(fetchNotificationsForRequestRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/notifications', { params }).then(response => {
|
api().get('/api/v1/notifications', { params }).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
|
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
|
||||||
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
|
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
|
||||||
|
@ -586,7 +586,7 @@ export const expandNotificationsForRequest = () => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(expandNotificationsForRequestRequest());
|
dispatch(expandNotificationsForRequestRequest());
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
|
dispatch(importFetchedAccounts(response.data.map(item => item.account)));
|
||||||
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
|
dispatch(importFetchedStatuses(response.data.map(item => item.status).filter(status => !!status)));
|
||||||
|
|
|
@ -8,10 +8,10 @@ export const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS';
|
||||||
export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL';
|
export const PINNED_STATUSES_FETCH_FAIL = 'PINNED_STATUSES_FETCH_FAIL';
|
||||||
|
|
||||||
export function fetchPinnedStatuses() {
|
export function fetchPinnedStatuses() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchPinnedStatusesRequest());
|
dispatch(fetchPinnedStatusesRequest());
|
||||||
|
|
||||||
api(getState).get(`/api/v1/accounts/${me}/statuses`, { params: { pinned: true } }).then(response => {
|
api().get(`/api/v1/accounts/${me}/statuses`, { params: { pinned: true } }).then(response => {
|
||||||
dispatch(importFetchedStatuses(response.data));
|
dispatch(importFetchedStatuses(response.data));
|
||||||
dispatch(fetchPinnedStatusesSuccess(response.data, null));
|
dispatch(fetchPinnedStatusesSuccess(response.data, null));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
|
@ -10,10 +10,10 @@ export const POLL_FETCH_REQUEST = 'POLL_FETCH_REQUEST';
|
||||||
export const POLL_FETCH_SUCCESS = 'POLL_FETCH_SUCCESS';
|
export const POLL_FETCH_SUCCESS = 'POLL_FETCH_SUCCESS';
|
||||||
export const POLL_FETCH_FAIL = 'POLL_FETCH_FAIL';
|
export const POLL_FETCH_FAIL = 'POLL_FETCH_FAIL';
|
||||||
|
|
||||||
export const vote = (pollId, choices) => (dispatch, getState) => {
|
export const vote = (pollId, choices) => (dispatch) => {
|
||||||
dispatch(voteRequest());
|
dispatch(voteRequest());
|
||||||
|
|
||||||
api(getState).post(`/api/v1/polls/${pollId}/votes`, { choices })
|
api().post(`/api/v1/polls/${pollId}/votes`, { choices })
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
dispatch(importFetchedPoll(data));
|
dispatch(importFetchedPoll(data));
|
||||||
dispatch(voteSuccess(data));
|
dispatch(voteSuccess(data));
|
||||||
|
@ -21,10 +21,10 @@ export const vote = (pollId, choices) => (dispatch, getState) => {
|
||||||
.catch(err => dispatch(voteFail(err)));
|
.catch(err => dispatch(voteFail(err)));
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fetchPoll = pollId => (dispatch, getState) => {
|
export const fetchPoll = pollId => (dispatch) => {
|
||||||
dispatch(fetchPollRequest());
|
dispatch(fetchPollRequest());
|
||||||
|
|
||||||
api(getState).get(`/api/v1/polls/${pollId}`)
|
api().get(`/api/v1/polls/${pollId}`)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
dispatch(importFetchedPoll(data));
|
dispatch(importFetchedPoll(data));
|
||||||
dispatch(fetchPollSuccess(data));
|
dispatch(fetchPollSuccess(data));
|
||||||
|
|
|
@ -15,10 +15,10 @@ export const initReport = (account, status) => dispatch =>
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const submitReport = (params, onSuccess, onFail) => (dispatch, getState) => {
|
export const submitReport = (params, onSuccess, onFail) => (dispatch) => {
|
||||||
dispatch(submitReportRequest());
|
dispatch(submitReportRequest());
|
||||||
|
|
||||||
api(getState).post('/api/v1/reports', params).then(response => {
|
api().post('/api/v1/reports', params).then(response => {
|
||||||
dispatch(submitReportSuccess(response.data));
|
dispatch(submitReportSuccess(response.data));
|
||||||
if (onSuccess) onSuccess();
|
if (onSuccess) onSuccess();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
|
@ -46,7 +46,7 @@ export function submitSearch(type) {
|
||||||
|
|
||||||
dispatch(fetchSearchRequest(type));
|
dispatch(fetchSearchRequest(type));
|
||||||
|
|
||||||
api(getState).get('/api/v2/search', {
|
api().get('/api/v2/search', {
|
||||||
params: {
|
params: {
|
||||||
q: value,
|
q: value,
|
||||||
resolve: signedIn,
|
resolve: signedIn,
|
||||||
|
@ -99,7 +99,7 @@ export const expandSearch = type => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(expandSearchRequest(type));
|
dispatch(expandSearchRequest(type));
|
||||||
|
|
||||||
api(getState).get('/api/v2/search', {
|
api().get('/api/v2/search', {
|
||||||
params: {
|
params: {
|
||||||
q: value,
|
q: value,
|
||||||
type,
|
type,
|
||||||
|
@ -156,7 +156,7 @@ export const openURL = (value, history, onFailure) => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchSearchRequest());
|
dispatch(fetchSearchRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v2/search', { params: { q: value, resolve: true } }).then(response => {
|
api().get('/api/v2/search', { params: { q: value, resolve: true } }).then(response => {
|
||||||
if (response.data.accounts?.length > 0) {
|
if (response.data.accounts?.length > 0) {
|
||||||
dispatch(importFetchedAccounts(response.data.accounts));
|
dispatch(importFetchedAccounts(response.data.accounts));
|
||||||
history.push(`/@${response.data.accounts[0].acct}`);
|
history.push(`/@${response.data.accounts[0].acct}`);
|
||||||
|
|
|
@ -25,7 +25,7 @@ export const fetchServer = () => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchServerRequest());
|
dispatch(fetchServerRequest());
|
||||||
|
|
||||||
api(getState)
|
api()
|
||||||
.get('/api/v2/instance').then(({ data }) => {
|
.get('/api/v2/instance').then(({ data }) => {
|
||||||
if (data.contact.account) dispatch(importFetchedAccount(data.contact.account));
|
if (data.contact.account) dispatch(importFetchedAccount(data.contact.account));
|
||||||
dispatch(fetchServerSuccess(data));
|
dispatch(fetchServerSuccess(data));
|
||||||
|
@ -46,10 +46,10 @@ const fetchServerFail = error => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchServerTranslationLanguages = () => (dispatch, getState) => {
|
export const fetchServerTranslationLanguages = () => (dispatch) => {
|
||||||
dispatch(fetchServerTranslationLanguagesRequest());
|
dispatch(fetchServerTranslationLanguagesRequest());
|
||||||
|
|
||||||
api(getState)
|
api()
|
||||||
.get('/api/v1/instance/translation_languages').then(({ data }) => {
|
.get('/api/v1/instance/translation_languages').then(({ data }) => {
|
||||||
dispatch(fetchServerTranslationLanguagesSuccess(data));
|
dispatch(fetchServerTranslationLanguagesSuccess(data));
|
||||||
}).catch(err => dispatch(fetchServerTranslationLanguagesFail(err)));
|
}).catch(err => dispatch(fetchServerTranslationLanguagesFail(err)));
|
||||||
|
@ -76,7 +76,7 @@ export const fetchExtendedDescription = () => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchExtendedDescriptionRequest());
|
dispatch(fetchExtendedDescriptionRequest());
|
||||||
|
|
||||||
api(getState)
|
api()
|
||||||
.get('/api/v1/instance/extended_description')
|
.get('/api/v1/instance/extended_description')
|
||||||
.then(({ data }) => dispatch(fetchExtendedDescriptionSuccess(data)))
|
.then(({ data }) => dispatch(fetchExtendedDescriptionSuccess(data)))
|
||||||
.catch(err => dispatch(fetchExtendedDescriptionFail(err)));
|
.catch(err => dispatch(fetchExtendedDescriptionFail(err)));
|
||||||
|
@ -103,7 +103,7 @@ export const fetchDomainBlocks = () => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchDomainBlocksRequest());
|
dispatch(fetchDomainBlocksRequest());
|
||||||
|
|
||||||
api(getState)
|
api()
|
||||||
.get('/api/v1/instance/domain_blocks')
|
.get('/api/v1/instance/domain_blocks')
|
||||||
.then(({ data }) => dispatch(fetchDomainBlocksSuccess(true, data)))
|
.then(({ data }) => dispatch(fetchDomainBlocksSuccess(true, data)))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|
|
@ -59,7 +59,7 @@ export function fetchStatus(id, forceFetch = false) {
|
||||||
|
|
||||||
dispatch(fetchStatusRequest(id, skipLoading));
|
dispatch(fetchStatusRequest(id, skipLoading));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/statuses/${id}`).then(response => {
|
api().get(`/api/v1/statuses/${id}`).then(response => {
|
||||||
dispatch(importFetchedStatus(response.data));
|
dispatch(importFetchedStatus(response.data));
|
||||||
dispatch(fetchStatusSuccess(skipLoading));
|
dispatch(fetchStatusSuccess(skipLoading));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -102,7 +102,7 @@ export const editStatus = (id, routerHistory) => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchStatusSourceRequest());
|
dispatch(fetchStatusSourceRequest());
|
||||||
|
|
||||||
api(getState).get(`/api/v1/statuses/${id}/source`).then(response => {
|
api().get(`/api/v1/statuses/${id}/source`).then(response => {
|
||||||
dispatch(fetchStatusSourceSuccess());
|
dispatch(fetchStatusSourceSuccess());
|
||||||
ensureComposeIsVisible(getState, routerHistory);
|
ensureComposeIsVisible(getState, routerHistory);
|
||||||
dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text));
|
dispatch(setComposeToStatus(status, response.data.text, response.data.spoiler_text));
|
||||||
|
@ -134,7 +134,7 @@ export function deleteStatus(id, routerHistory, withRedraft = false) {
|
||||||
|
|
||||||
dispatch(deleteStatusRequest(id));
|
dispatch(deleteStatusRequest(id));
|
||||||
|
|
||||||
api(getState).delete(`/api/v1/statuses/${id}`).then(response => {
|
api().delete(`/api/v1/statuses/${id}`).then(response => {
|
||||||
dispatch(deleteStatusSuccess(id));
|
dispatch(deleteStatusSuccess(id));
|
||||||
dispatch(deleteFromTimelines(id));
|
dispatch(deleteFromTimelines(id));
|
||||||
dispatch(importFetchedAccount(response.data.account));
|
dispatch(importFetchedAccount(response.data.account));
|
||||||
|
@ -175,10 +175,10 @@ export const updateStatus = status => dispatch =>
|
||||||
dispatch(importFetchedStatus(status));
|
dispatch(importFetchedStatus(status));
|
||||||
|
|
||||||
export function fetchContext(id) {
|
export function fetchContext(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchContextRequest(id));
|
dispatch(fetchContextRequest(id));
|
||||||
|
|
||||||
api(getState).get(`/api/v1/statuses/${id}/context`).then(response => {
|
api().get(`/api/v1/statuses/${id}/context`).then(response => {
|
||||||
dispatch(importFetchedStatuses(response.data.ancestors.concat(response.data.descendants)));
|
dispatch(importFetchedStatuses(response.data.ancestors.concat(response.data.descendants)));
|
||||||
dispatch(fetchContextSuccess(id, response.data.ancestors, response.data.descendants));
|
dispatch(fetchContextSuccess(id, response.data.ancestors, response.data.descendants));
|
||||||
|
|
||||||
|
@ -219,10 +219,10 @@ export function fetchContextFail(id, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function muteStatus(id) {
|
export function muteStatus(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(muteStatusRequest(id));
|
dispatch(muteStatusRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${id}/mute`).then(() => {
|
api().post(`/api/v1/statuses/${id}/mute`).then(() => {
|
||||||
dispatch(muteStatusSuccess(id));
|
dispatch(muteStatusSuccess(id));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(muteStatusFail(id, error));
|
dispatch(muteStatusFail(id, error));
|
||||||
|
@ -253,10 +253,10 @@ export function muteStatusFail(id, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unmuteStatus(id) {
|
export function unmuteStatus(id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(unmuteStatusRequest(id));
|
dispatch(unmuteStatusRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${id}/unmute`).then(() => {
|
api().post(`/api/v1/statuses/${id}/unmute`).then(() => {
|
||||||
dispatch(unmuteStatusSuccess(id));
|
dispatch(unmuteStatusSuccess(id));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(unmuteStatusFail(id, error));
|
dispatch(unmuteStatusFail(id, error));
|
||||||
|
@ -316,10 +316,10 @@ export function toggleStatusCollapse(id, isCollapsed) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const translateStatus = id => (dispatch, getState) => {
|
export const translateStatus = id => (dispatch) => {
|
||||||
dispatch(translateStatusRequest(id));
|
dispatch(translateStatusRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${id}/translate`).then(response => {
|
api().post(`/api/v1/statuses/${id}/translate`).then(response => {
|
||||||
dispatch(translateStatusSuccess(id, response.data));
|
dispatch(translateStatusSuccess(id, response.data));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(translateStatusFail(id, error));
|
dispatch(translateStatusFail(id, error));
|
||||||
|
|
|
@ -10,10 +10,10 @@ export const SUGGESTIONS_FETCH_FAIL = 'SUGGESTIONS_FETCH_FAIL';
|
||||||
export const SUGGESTIONS_DISMISS = 'SUGGESTIONS_DISMISS';
|
export const SUGGESTIONS_DISMISS = 'SUGGESTIONS_DISMISS';
|
||||||
|
|
||||||
export function fetchSuggestions(withRelationships = false) {
|
export function fetchSuggestions(withRelationships = false) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch) => {
|
||||||
dispatch(fetchSuggestionsRequest());
|
dispatch(fetchSuggestionsRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v2/suggestions', { params: { limit: 20 } }).then(response => {
|
api().get('/api/v2/suggestions', { params: { limit: 20 } }).then(response => {
|
||||||
dispatch(importFetchedAccounts(response.data.map(x => x.account)));
|
dispatch(importFetchedAccounts(response.data.map(x => x.account)));
|
||||||
dispatch(fetchSuggestionsSuccess(response.data));
|
dispatch(fetchSuggestionsSuccess(response.data));
|
||||||
|
|
||||||
|
@ -48,11 +48,11 @@ export function fetchSuggestionsFail(error) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const dismissSuggestion = accountId => (dispatch, getState) => {
|
export const dismissSuggestion = accountId => (dispatch) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: SUGGESTIONS_DISMISS,
|
type: SUGGESTIONS_DISMISS,
|
||||||
id: accountId,
|
id: accountId,
|
||||||
});
|
});
|
||||||
|
|
||||||
api(getState).delete(`/api/v1/suggestions/${accountId}`).catch(() => {});
|
api().delete(`/api/v1/suggestions/${accountId}`).catch(() => {});
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,10 +20,10 @@ export const HASHTAG_UNFOLLOW_REQUEST = 'HASHTAG_UNFOLLOW_REQUEST';
|
||||||
export const HASHTAG_UNFOLLOW_SUCCESS = 'HASHTAG_UNFOLLOW_SUCCESS';
|
export const HASHTAG_UNFOLLOW_SUCCESS = 'HASHTAG_UNFOLLOW_SUCCESS';
|
||||||
export const HASHTAG_UNFOLLOW_FAIL = 'HASHTAG_UNFOLLOW_FAIL';
|
export const HASHTAG_UNFOLLOW_FAIL = 'HASHTAG_UNFOLLOW_FAIL';
|
||||||
|
|
||||||
export const fetchHashtag = name => (dispatch, getState) => {
|
export const fetchHashtag = name => (dispatch) => {
|
||||||
dispatch(fetchHashtagRequest());
|
dispatch(fetchHashtagRequest());
|
||||||
|
|
||||||
api(getState).get(`/api/v1/tags/${name}`).then(({ data }) => {
|
api().get(`/api/v1/tags/${name}`).then(({ data }) => {
|
||||||
dispatch(fetchHashtagSuccess(name, data));
|
dispatch(fetchHashtagSuccess(name, data));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(fetchHashtagFail(err));
|
dispatch(fetchHashtagFail(err));
|
||||||
|
@ -45,10 +45,10 @@ export const fetchHashtagFail = error => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchFollowedHashtags = () => (dispatch, getState) => {
|
export const fetchFollowedHashtags = () => (dispatch) => {
|
||||||
dispatch(fetchFollowedHashtagsRequest());
|
dispatch(fetchFollowedHashtagsRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/followed_tags').then(response => {
|
api().get('/api/v1/followed_tags').then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(fetchFollowedHashtagsSuccess(response.data, next ? next.uri : null));
|
dispatch(fetchFollowedHashtagsSuccess(response.data, next ? next.uri : null));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
@ -87,7 +87,7 @@ export function expandFollowedHashtags() {
|
||||||
|
|
||||||
dispatch(expandFollowedHashtagsRequest());
|
dispatch(expandFollowedHashtagsRequest());
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(expandFollowedHashtagsSuccess(response.data, next ? next.uri : null));
|
dispatch(expandFollowedHashtagsSuccess(response.data, next ? next.uri : null));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -117,10 +117,10 @@ export function expandFollowedHashtagsFail(error) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const followHashtag = name => (dispatch, getState) => {
|
export const followHashtag = name => (dispatch) => {
|
||||||
dispatch(followHashtagRequest(name));
|
dispatch(followHashtagRequest(name));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/tags/${name}/follow`).then(({ data }) => {
|
api().post(`/api/v1/tags/${name}/follow`).then(({ data }) => {
|
||||||
dispatch(followHashtagSuccess(name, data));
|
dispatch(followHashtagSuccess(name, data));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(followHashtagFail(name, err));
|
dispatch(followHashtagFail(name, err));
|
||||||
|
@ -144,10 +144,10 @@ export const followHashtagFail = (name, error) => ({
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const unfollowHashtag = name => (dispatch, getState) => {
|
export const unfollowHashtag = name => (dispatch) => {
|
||||||
dispatch(unfollowHashtagRequest(name));
|
dispatch(unfollowHashtagRequest(name));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/tags/${name}/unfollow`).then(({ data }) => {
|
api().post(`/api/v1/tags/${name}/unfollow`).then(({ data }) => {
|
||||||
dispatch(unfollowHashtagSuccess(name, data));
|
dispatch(unfollowHashtagSuccess(name, data));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(unfollowHashtagFail(name, err));
|
dispatch(unfollowHashtagFail(name, err));
|
||||||
|
|
|
@ -114,7 +114,7 @@ export function expandTimeline(timelineId, path, params = {}, done = noOp) {
|
||||||
|
|
||||||
dispatch(expandTimelineRequest(timelineId, isLoadingMore));
|
dispatch(expandTimelineRequest(timelineId, isLoadingMore));
|
||||||
|
|
||||||
api(getState).get(path, { params }).then(response => {
|
api().get(path, { params }).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
||||||
dispatch(importFetchedStatuses(response.data));
|
dispatch(importFetchedStatuses(response.data));
|
||||||
|
|
|
@ -18,10 +18,10 @@ export const TRENDS_STATUSES_EXPAND_REQUEST = 'TRENDS_STATUSES_EXPAND_REQUEST';
|
||||||
export const TRENDS_STATUSES_EXPAND_SUCCESS = 'TRENDS_STATUSES_EXPAND_SUCCESS';
|
export const TRENDS_STATUSES_EXPAND_SUCCESS = 'TRENDS_STATUSES_EXPAND_SUCCESS';
|
||||||
export const TRENDS_STATUSES_EXPAND_FAIL = 'TRENDS_STATUSES_EXPAND_FAIL';
|
export const TRENDS_STATUSES_EXPAND_FAIL = 'TRENDS_STATUSES_EXPAND_FAIL';
|
||||||
|
|
||||||
export const fetchTrendingHashtags = () => (dispatch, getState) => {
|
export const fetchTrendingHashtags = () => (dispatch) => {
|
||||||
dispatch(fetchTrendingHashtagsRequest());
|
dispatch(fetchTrendingHashtagsRequest());
|
||||||
|
|
||||||
api(getState)
|
api()
|
||||||
.get('/api/v1/trends/tags')
|
.get('/api/v1/trends/tags')
|
||||||
.then(({ data }) => dispatch(fetchTrendingHashtagsSuccess(data)))
|
.then(({ data }) => dispatch(fetchTrendingHashtagsSuccess(data)))
|
||||||
.catch(err => dispatch(fetchTrendingHashtagsFail(err)));
|
.catch(err => dispatch(fetchTrendingHashtagsFail(err)));
|
||||||
|
@ -45,10 +45,10 @@ export const fetchTrendingHashtagsFail = error => ({
|
||||||
skipAlert: true,
|
skipAlert: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const fetchTrendingLinks = () => (dispatch, getState) => {
|
export const fetchTrendingLinks = () => (dispatch) => {
|
||||||
dispatch(fetchTrendingLinksRequest());
|
dispatch(fetchTrendingLinksRequest());
|
||||||
|
|
||||||
api(getState)
|
api()
|
||||||
.get('/api/v1/trends/links')
|
.get('/api/v1/trends/links')
|
||||||
.then(({ data }) => dispatch(fetchTrendingLinksSuccess(data)))
|
.then(({ data }) => dispatch(fetchTrendingLinksSuccess(data)))
|
||||||
.catch(err => dispatch(fetchTrendingLinksFail(err)));
|
.catch(err => dispatch(fetchTrendingLinksFail(err)));
|
||||||
|
@ -79,7 +79,7 @@ export const fetchTrendingStatuses = () => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(fetchTrendingStatusesRequest());
|
dispatch(fetchTrendingStatusesRequest());
|
||||||
|
|
||||||
api(getState).get('/api/v1/trends/statuses').then(response => {
|
api().get('/api/v1/trends/statuses').then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedStatuses(response.data));
|
dispatch(importFetchedStatuses(response.data));
|
||||||
dispatch(fetchTrendingStatusesSuccess(response.data, next ? next.uri : null));
|
dispatch(fetchTrendingStatusesSuccess(response.data, next ? next.uri : null));
|
||||||
|
@ -115,7 +115,7 @@ export const expandTrendingStatuses = () => (dispatch, getState) => {
|
||||||
|
|
||||||
dispatch(expandTrendingStatusesRequest());
|
dispatch(expandTrendingStatusesRequest());
|
||||||
|
|
||||||
api(getState).get(url).then(response => {
|
api().get(url).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
dispatch(importFetchedStatuses(response.data));
|
dispatch(importFetchedStatuses(response.data));
|
||||||
dispatch(expandTrendingStatusesSuccess(response.data, next ? next.uri : null));
|
dispatch(expandTrendingStatusesSuccess(response.data, next ? next.uri : null));
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import type { AxiosResponse, RawAxiosRequestHeaders } from 'axios';
|
import type { AxiosResponse, Method, RawAxiosRequestHeaders } from 'axios';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import LinkHeader from 'http-link-header';
|
import LinkHeader from 'http-link-header';
|
||||||
|
|
||||||
|
import { getAccessToken } from './initial_state';
|
||||||
import ready from './ready';
|
import ready from './ready';
|
||||||
import type { GetState } from './store';
|
|
||||||
|
|
||||||
export const getLinks = (response: AxiosResponse) => {
|
export const getLinks = (response: AxiosResponse) => {
|
||||||
const value = response.headers.link as string | undefined;
|
const value = response.headers.link as string | undefined;
|
||||||
|
@ -29,30 +29,22 @@ const setCSRFHeader = () => {
|
||||||
|
|
||||||
void ready(setCSRFHeader);
|
void ready(setCSRFHeader);
|
||||||
|
|
||||||
export const authorizationTokenFromState = (getState?: GetState) => {
|
const authorizationTokenFromInitialState = (): RawAxiosRequestHeaders => {
|
||||||
return (
|
const accessToken = getAccessToken();
|
||||||
getState && (getState().meta.get('access_token', '') as string | false)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const authorizationHeaderFromState = (getState?: GetState) => {
|
if (!accessToken) return {};
|
||||||
const accessToken = authorizationTokenFromState(getState);
|
|
||||||
|
|
||||||
if (!accessToken) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
} as RawAxiosRequestHeaders;
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default function api(getState: GetState) {
|
export default function api(withAuthorization = true) {
|
||||||
return axios.create({
|
return axios.create({
|
||||||
headers: {
|
headers: {
|
||||||
...csrfHeader,
|
...csrfHeader,
|
||||||
...authorizationHeaderFromState(getState),
|
...(withAuthorization ? authorizationTokenFromInitialState() : {}),
|
||||||
},
|
},
|
||||||
|
|
||||||
transformResponse: [
|
transformResponse: [
|
||||||
|
@ -66,3 +58,17 @@ export default function api(getState: GetState) {
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function apiRequest<ApiResponse = unknown>(
|
||||||
|
method: Method,
|
||||||
|
url: string,
|
||||||
|
params?: Record<string, unknown>,
|
||||||
|
) {
|
||||||
|
const { data } = await api().request<ApiResponse>({
|
||||||
|
method,
|
||||||
|
url: '/api/' + url,
|
||||||
|
data: params,
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
7
app/javascript/mastodon/api/accounts.ts
Normal file
7
app/javascript/mastodon/api/accounts.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { apiRequest } from 'mastodon/api';
|
||||||
|
import type { ApiRelationshipJSON } from 'mastodon/api_types/relationships';
|
||||||
|
|
||||||
|
export const apiSubmitAccountNote = (id: string, value: string) =>
|
||||||
|
apiRequest<ApiRelationshipJSON>('post', `v1/accounts/${id}/note`, {
|
||||||
|
comment: value,
|
||||||
|
});
|
10
app/javascript/mastodon/api/interactions.ts
Normal file
10
app/javascript/mastodon/api/interactions.ts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import { apiRequest } from 'mastodon/api';
|
||||||
|
import type { Status, StatusVisibility } from 'mastodon/models/status';
|
||||||
|
|
||||||
|
export const apiReblog = (statusId: string, visibility: StatusVisibility) =>
|
||||||
|
apiRequest<{ reblog: Status }>('post', `v1/statuses/${statusId}/reblog`, {
|
||||||
|
visibility,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const apiUnreblog = (statusId: string) =>
|
||||||
|
apiRequest<Status>('post', `v1/statuses/${statusId}/unreblog`);
|
|
@ -48,7 +48,7 @@ export default class Counter extends PureComponent {
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const { measure, start_at, end_at, params } = this.props;
|
const { measure, start_at, end_at, params } = this.props;
|
||||||
|
|
||||||
api().post('/api/v1/admin/measures', { keys: [measure], start_at, end_at, [measure]: params }).then(res => {
|
api(false).post('/api/v1/admin/measures', { keys: [measure], start_at, end_at, [measure]: params }).then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
data: res.data,
|
data: res.data,
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default class Dimension extends PureComponent {
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const { start_at, end_at, dimension, limit, params } = this.props;
|
const { start_at, end_at, dimension, limit, params } = this.props;
|
||||||
|
|
||||||
api().post('/api/v1/admin/dimensions', { keys: [dimension], start_at, end_at, limit, [dimension]: params }).then(res => {
|
api(false).post('/api/v1/admin/dimensions', { keys: [dimension], start_at, end_at, limit, [dimension]: params }).then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
data: res.data,
|
data: res.data,
|
||||||
|
|
|
@ -27,7 +27,7 @@ export default class ImpactReport extends PureComponent {
|
||||||
include_subdomains: true,
|
include_subdomains: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
api().post('/api/v1/admin/measures', {
|
api(false).post('/api/v1/admin/measures', {
|
||||||
keys: ['instance_accounts', 'instance_follows', 'instance_followers'],
|
keys: ['instance_accounts', 'instance_follows', 'instance_followers'],
|
||||||
start_at: null,
|
start_at: null,
|
||||||
end_at: null,
|
end_at: null,
|
||||||
|
|
|
@ -105,7 +105,7 @@ class ReportReasonSelector extends PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
api().get('/api/v1/instance').then(res => {
|
api(false).get('/api/v1/instance').then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
rules: res.data.rules,
|
rules: res.data.rules,
|
||||||
});
|
});
|
||||||
|
@ -122,7 +122,7 @@ class ReportReasonSelector extends PureComponent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
api().put(`/api/v1/admin/reports/${id}`, {
|
api(false).put(`/api/v1/admin/reports/${id}`, {
|
||||||
category,
|
category,
|
||||||
rule_ids: category === 'violation' ? rule_ids : [],
|
rule_ids: category === 'violation' ? rule_ids : [],
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|
|
@ -34,7 +34,7 @@ export default class Retention extends PureComponent {
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const { start_at, end_at, frequency } = this.props;
|
const { start_at, end_at, frequency } = this.props;
|
||||||
|
|
||||||
api().post('/api/v1/admin/retention', { start_at, end_at, frequency }).then(res => {
|
api(false).post('/api/v1/admin/retention', { start_at, end_at, frequency }).then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
data: res.data,
|
data: res.data,
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default class Trends extends PureComponent {
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const { limit } = this.props;
|
const { limit } = this.props;
|
||||||
|
|
||||||
api().get('/api/v1/admin/trends/tags', { params: { limit } }).then(res => {
|
api(false).get('/api/v1/admin/trends/tags', { params: { limit } }).then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
data: res.data,
|
data: res.data,
|
||||||
|
|
|
@ -48,8 +48,9 @@ export const AnimatedNumber: React.FC<Props> = ({ value }) => {
|
||||||
<span
|
<span
|
||||||
key={key}
|
key={key}
|
||||||
style={{
|
style={{
|
||||||
position: direction * style.y > 0 ? 'absolute' : 'static',
|
position:
|
||||||
transform: `translateY(${style.y * 100}%)`,
|
direction * (style.y ?? 0) > 0 ? 'absolute' : 'static',
|
||||||
|
transform: `translateY(${(style.y ?? 0) * 100}%)`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ShortNumber value={data as number} />
|
<ShortNumber value={data as number} />
|
||||||
|
|
|
@ -52,7 +52,10 @@ function uniqueHashtagsWithCaseHandling(hashtags: string[]) {
|
||||||
);
|
);
|
||||||
|
|
||||||
return Object.values(groups).map((tags) => {
|
return Object.values(groups).map((tags) => {
|
||||||
if (tags.length === 1) return tags[0];
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we know that the array has at least one element
|
||||||
|
const firstTag = tags[0]!;
|
||||||
|
|
||||||
|
if (tags.length === 1) return firstTag;
|
||||||
|
|
||||||
// The best match is the one where we have the less difference between upper and lower case letter count
|
// The best match is the one where we have the less difference between upper and lower case letter count
|
||||||
const best = minBy(tags, (tag) => {
|
const best = minBy(tags, (tag) => {
|
||||||
|
@ -66,7 +69,7 @@ function uniqueHashtagsWithCaseHandling(hashtags: string[]) {
|
||||||
return Math.abs(lowerCase - upperCase);
|
return Math.abs(lowerCase - upperCase);
|
||||||
});
|
});
|
||||||
|
|
||||||
return best ?? tags[0];
|
return best ?? firstTag;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ const ShortNumberCounter: React.FC<ShortNumberCounterProps> = ({ value }) => {
|
||||||
|
|
||||||
const count = (
|
const count = (
|
||||||
<FormattedNumber
|
<FormattedNumber
|
||||||
value={rawNumber}
|
value={rawNumber ?? 0}
|
||||||
maximumFractionDigits={maxFractionDigits}
|
maximumFractionDigits={maxFractionDigits}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -96,9 +96,9 @@ const mapDispatchToProps = (dispatch, { intl, contextType }) => ({
|
||||||
|
|
||||||
onModalReblog (status, privacy) {
|
onModalReblog (status, privacy) {
|
||||||
if (status.get('reblogged')) {
|
if (status.get('reblogged')) {
|
||||||
dispatch(unreblog(status));
|
dispatch(unreblog({ statusId: status.get('id') }));
|
||||||
} else {
|
} else {
|
||||||
dispatch(reblog(status, privacy));
|
dispatch(reblog({ statusId: status.get('id'), visibility: privacy }));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ const mapStateToProps = (state, { account }) => ({
|
||||||
const mapDispatchToProps = (dispatch, { account }) => ({
|
const mapDispatchToProps = (dispatch, { account }) => ({
|
||||||
|
|
||||||
onSave (value) {
|
onSave (value) {
|
||||||
dispatch(submitAccountNote({ id: account.get('id'), value}));
|
dispatch(submitAccountNote({ accountId: account.get('id'), note: value }));
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,7 +29,10 @@ const emojis: Emojis = {};
|
||||||
|
|
||||||
// decompress
|
// decompress
|
||||||
Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
|
Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
|
||||||
const [_filenameData, searchData] = shortCodesToEmojiData[shortCode];
|
const emojiData = shortCodesToEmojiData[shortCode];
|
||||||
|
if (!emojiData) return;
|
||||||
|
|
||||||
|
const [_filenameData, searchData] = emojiData;
|
||||||
const [native, short_names, search, unified] = searchData;
|
const [native, short_names, search, unified] = searchData;
|
||||||
|
|
||||||
emojis[shortCode] = {
|
emojis[shortCode] = {
|
||||||
|
|
|
@ -46,7 +46,10 @@ function processEmojiMapData(
|
||||||
Object.keys(shortCodesToEmojiData).forEach(
|
Object.keys(shortCodesToEmojiData).forEach(
|
||||||
(shortCode: ShortCodesToEmojiDataKey) => {
|
(shortCode: ShortCodesToEmojiDataKey) => {
|
||||||
if (shortCode === undefined) return;
|
if (shortCode === undefined) return;
|
||||||
const [filenameData, _searchData] = shortCodesToEmojiData[shortCode];
|
|
||||||
|
const emojiData = shortCodesToEmojiData[shortCode];
|
||||||
|
if (!emojiData) return;
|
||||||
|
const [filenameData, _searchData] = emojiData;
|
||||||
filenameData.forEach((emojiMapData) => {
|
filenameData.forEach((emojiMapData) => {
|
||||||
processEmojiMapData(emojiMapData, shortCode);
|
processEmojiMapData(emojiMapData, shortCode);
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@ const mapStateToProps = (state, { columnId }) => {
|
||||||
return {
|
return {
|
||||||
settings: columns.get(index).get('params'),
|
settings: columns.get(index).get('params'),
|
||||||
onLoad (value) {
|
onLoad (value) {
|
||||||
return api(() => state).get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {
|
return api().get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {
|
||||||
return (response.data.hashtags || []).map((tag) => {
|
return (response.data.hashtags || []).map((tag) => {
|
||||||
return { value: tag.name, label: `#${tag.name}` };
|
return { value: tag.name, label: `#${tag.name}` };
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,12 +39,12 @@ const mapDispatchToProps = dispatch => ({
|
||||||
},
|
},
|
||||||
|
|
||||||
onModalReblog (status, privacy) {
|
onModalReblog (status, privacy) {
|
||||||
dispatch(reblog(status, privacy));
|
dispatch(reblog({ statusId: status.get('id'), visibility: privacy }));
|
||||||
},
|
},
|
||||||
|
|
||||||
onReblog (status, e) {
|
onReblog (status, e) {
|
||||||
if (status.get('reblogged')) {
|
if (status.get('reblogged')) {
|
||||||
dispatch(unreblog(status));
|
dispatch(unreblog({ statusId: status.get('id') }));
|
||||||
} else {
|
} else {
|
||||||
if (e.shiftKey || !boostModal) {
|
if (e.shiftKey || !boostModal) {
|
||||||
this.onModalReblog(status);
|
this.onModalReblog(status);
|
||||||
|
|
|
@ -123,7 +123,7 @@ class Footer extends ImmutablePureComponent {
|
||||||
|
|
||||||
_performReblog = (status, privacy) => {
|
_performReblog = (status, privacy) => {
|
||||||
const { dispatch } = this.props;
|
const { dispatch } = this.props;
|
||||||
dispatch(reblog(status, privacy));
|
dispatch(reblog({ statusId: status.get('id'), visibility: privacy }));
|
||||||
};
|
};
|
||||||
|
|
||||||
handleReblogClick = e => {
|
handleReblogClick = e => {
|
||||||
|
@ -132,7 +132,7 @@ class Footer extends ImmutablePureComponent {
|
||||||
|
|
||||||
if (signedIn) {
|
if (signedIn) {
|
||||||
if (status.get('reblogged')) {
|
if (status.get('reblogged')) {
|
||||||
dispatch(unreblog(status));
|
dispatch(unreblog({ statusId: status.get('id') }));
|
||||||
} else if ((e && e.shiftKey) || !boostModal) {
|
} else if ((e && e.shiftKey) || !boostModal) {
|
||||||
this._performReblog(status);
|
this._performReblog(status);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,6 +6,8 @@ import { PureComponent } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
|
||||||
import Immutable from 'immutable';
|
import Immutable from 'immutable';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
@ -13,6 +15,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import DescriptionIcon from '@/material-icons/400-24px/description-fill.svg?react';
|
import DescriptionIcon from '@/material-icons/400-24px/description-fill.svg?react';
|
||||||
import OpenInNewIcon from '@/material-icons/400-24px/open_in_new.svg?react';
|
import OpenInNewIcon from '@/material-icons/400-24px/open_in_new.svg?react';
|
||||||
import PlayArrowIcon from '@/material-icons/400-24px/play_arrow-fill.svg?react';
|
import PlayArrowIcon from '@/material-icons/400-24px/play_arrow-fill.svg?react';
|
||||||
|
import { Avatar } from 'mastodon/components/avatar';
|
||||||
import { Blurhash } from 'mastodon/components/blurhash';
|
import { Blurhash } from 'mastodon/components/blurhash';
|
||||||
import { Icon } from 'mastodon/components/icon';
|
import { Icon } from 'mastodon/components/icon';
|
||||||
import { RelativeTimestamp } from 'mastodon/components/relative_timestamp';
|
import { RelativeTimestamp } from 'mastodon/components/relative_timestamp';
|
||||||
|
@ -56,6 +59,20 @@ const addAutoPlay = html => {
|
||||||
return html;
|
return html;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const MoreFromAuthor = ({ author }) => (
|
||||||
|
<div className='more-from-author'>
|
||||||
|
<svg viewBox='0 0 79 79' className='logo logo--icon' role='img'>
|
||||||
|
<use xlinkHref='#logo-symbol-icon' />
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<FormattedMessage id='link_preview.more_from_author' defaultMessage='More from {name}' values={{ name: <Link to={`/@${author.get('acct')}`}><Avatar account={author} size={16} /> {author.get('display_name')}</Link> }} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
MoreFromAuthor.propTypes = {
|
||||||
|
author: ImmutablePropTypes.map,
|
||||||
|
};
|
||||||
|
|
||||||
export default class Card extends PureComponent {
|
export default class Card extends PureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -136,6 +153,7 @@ export default class Card extends PureComponent {
|
||||||
const interactive = card.get('type') === 'video';
|
const interactive = card.get('type') === 'video';
|
||||||
const language = card.get('language') || '';
|
const language = card.get('language') || '';
|
||||||
const largeImage = (card.get('image')?.length > 0 && card.get('width') > card.get('height')) || interactive;
|
const largeImage = (card.get('image')?.length > 0 && card.get('width') > card.get('height')) || interactive;
|
||||||
|
const showAuthor = !!card.get('author_account');
|
||||||
|
|
||||||
const description = (
|
const description = (
|
||||||
<div className='status-card__content'>
|
<div className='status-card__content'>
|
||||||
|
@ -146,7 +164,7 @@ export default class Card extends PureComponent {
|
||||||
|
|
||||||
<strong className='status-card__title' title={card.get('title')} lang={language}>{card.get('title')}</strong>
|
<strong className='status-card__title' title={card.get('title')} lang={language}>{card.get('title')}</strong>
|
||||||
|
|
||||||
{card.get('author_name').length > 0 ? <span className='status-card__author'><FormattedMessage id='link_preview.author' defaultMessage='By {name}' values={{ name: <strong>{card.get('author_name')}</strong> }} /></span> : <span className='status-card__description' lang={language}>{card.get('description')}</span>}
|
{!showAuthor && (card.get('author_name').length > 0 ? <span className='status-card__author'><FormattedMessage id='link_preview.author' defaultMessage='By {name}' values={{ name: <strong>{card.get('author_name')}</strong> }} /></span> : <span className='status-card__description' lang={language}>{card.get('description')}</span>)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -235,10 +253,14 @@ export default class Card extends PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a href={card.get('url')} className={classNames('status-card', { expanded: largeImage })} target='_blank' rel='noopener noreferrer' ref={this.setRef}>
|
<>
|
||||||
{embed}
|
<a href={card.get('url')} className={classNames('status-card', { expanded: largeImage, bottomless: showAuthor })} target='_blank' rel='noopener noreferrer' ref={this.setRef}>
|
||||||
{description}
|
{embed}
|
||||||
</a>
|
{description}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
{showAuthor && <MoreFromAuthor author={card.get('author_account')} />}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,12 +74,12 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
},
|
},
|
||||||
|
|
||||||
onModalReblog (status, privacy) {
|
onModalReblog (status, privacy) {
|
||||||
dispatch(reblog(status, privacy));
|
dispatch(reblog({ statusId: status.get('id'), visibility: privacy }));
|
||||||
},
|
},
|
||||||
|
|
||||||
onReblog (status, e) {
|
onReblog (status, e) {
|
||||||
if (status.get('reblogged')) {
|
if (status.get('reblogged')) {
|
||||||
dispatch(unreblog(status));
|
dispatch(unreblog({ statusId: status.get('id') }));
|
||||||
} else {
|
} else {
|
||||||
if (e.shiftKey || !boostModal) {
|
if (e.shiftKey || !boostModal) {
|
||||||
this.onModalReblog(status);
|
this.onModalReblog(status);
|
||||||
|
|
|
@ -299,7 +299,7 @@ class Status extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleModalReblog = (status, privacy) => {
|
handleModalReblog = (status, privacy) => {
|
||||||
this.props.dispatch(reblog(status, privacy));
|
this.props.dispatch(reblog({ statusId: status.get('id'), visibility: privacy }));
|
||||||
};
|
};
|
||||||
|
|
||||||
handleReblogClick = (status, e) => {
|
handleReblogClick = (status, e) => {
|
||||||
|
@ -308,7 +308,7 @@ class Status extends ImmutablePureComponent {
|
||||||
|
|
||||||
if (signedIn) {
|
if (signedIn) {
|
||||||
if (status.get('reblogged')) {
|
if (status.get('reblogged')) {
|
||||||
dispatch(unreblog(status));
|
dispatch(unreblog({ statusId: status.get('id') }));
|
||||||
} else {
|
} else {
|
||||||
if ((e && e.shiftKey) || !boostModal) {
|
if ((e && e.shiftKey) || !boostModal) {
|
||||||
this.handleModalReblog(status);
|
this.handleModalReblog(status);
|
||||||
|
|
|
@ -9,7 +9,6 @@ export interface IdentityContextType {
|
||||||
signedIn: boolean;
|
signedIn: boolean;
|
||||||
accountId: string | undefined;
|
accountId: string | undefined;
|
||||||
disabledAccountId: string | undefined;
|
disabledAccountId: string | undefined;
|
||||||
accessToken: string | undefined;
|
|
||||||
permissions: number;
|
permissions: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,14 +16,12 @@ export const identityContextPropShape = PropTypes.shape({
|
||||||
signedIn: PropTypes.bool.isRequired,
|
signedIn: PropTypes.bool.isRequired,
|
||||||
accountId: PropTypes.string,
|
accountId: PropTypes.string,
|
||||||
disabledAccountId: PropTypes.string,
|
disabledAccountId: PropTypes.string,
|
||||||
accessToken: PropTypes.string,
|
|
||||||
}).isRequired;
|
}).isRequired;
|
||||||
|
|
||||||
export const createIdentityContext = (state: InitialState) => ({
|
export const createIdentityContext = (state: InitialState) => ({
|
||||||
signedIn: !!state.meta.me,
|
signedIn: !!state.meta.me,
|
||||||
accountId: state.meta.me,
|
accountId: state.meta.me,
|
||||||
disabledAccountId: state.meta.disabled_account_id,
|
disabledAccountId: state.meta.disabled_account_id,
|
||||||
accessToken: state.meta.access_token,
|
|
||||||
permissions: state.role?.permissions ?? 0,
|
permissions: state.role?.permissions ?? 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,7 +30,6 @@ export const IdentityContext = createContext<IdentityContextType>({
|
||||||
permissions: 0,
|
permissions: 0,
|
||||||
accountId: undefined,
|
accountId: undefined,
|
||||||
disabledAccountId: undefined,
|
disabledAccountId: undefined,
|
||||||
accessToken: undefined,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const useIdentity = () => useContext(IdentityContext);
|
export const useIdentity = () => useContext(IdentityContext);
|
||||||
|
|
|
@ -117,4 +117,11 @@ export const criticalUpdatesPending = initialState?.critical_updates_pending;
|
||||||
export const statusPageUrl = getMeta('status_page_url');
|
export const statusPageUrl = getMeta('status_page_url');
|
||||||
export const sso_redirect = getMeta('sso_redirect');
|
export const sso_redirect = getMeta('sso_redirect');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {string | undefined}
|
||||||
|
*/
|
||||||
|
export function getAccessToken() {
|
||||||
|
return getMeta('access_token');
|
||||||
|
}
|
||||||
|
|
||||||
export default initialState;
|
export default initialState;
|
||||||
|
|
|
@ -469,6 +469,7 @@
|
||||||
"notification.follow": "{name} падпісаўся на вас",
|
"notification.follow": "{name} падпісаўся на вас",
|
||||||
"notification.follow_request": "{name} адправіў запыт на падпіску",
|
"notification.follow_request": "{name} адправіў запыт на падпіску",
|
||||||
"notification.mention": "{name} згадаў вас",
|
"notification.mention": "{name} згадаў вас",
|
||||||
|
"notification.moderation-warning.learn_more": "Даведацца больш",
|
||||||
"notification.own_poll": "Ваша апытанне скончылася",
|
"notification.own_poll": "Ваша апытанне скончылася",
|
||||||
"notification.poll": "Апытанне, дзе вы прынялі ўдзел, скончылася",
|
"notification.poll": "Апытанне, дзе вы прынялі ўдзел, скончылася",
|
||||||
"notification.reblog": "{name} пашырыў ваш допіс",
|
"notification.reblog": "{name} пашырыў ваш допіс",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Mostra el perfil de totes maneres",
|
"limited_account_hint.action": "Mostra el perfil de totes maneres",
|
||||||
"limited_account_hint.title": "Aquest perfil l'han amagat els moderadors de {domain}.",
|
"limited_account_hint.title": "Aquest perfil l'han amagat els moderadors de {domain}.",
|
||||||
"link_preview.author": "Per {name}",
|
"link_preview.author": "Per {name}",
|
||||||
|
"link_preview.more_from_author": "Més de {name}",
|
||||||
"lists.account.add": "Afegeix a la llista",
|
"lists.account.add": "Afegeix a la llista",
|
||||||
"lists.account.remove": "Elimina de la llista",
|
"lists.account.remove": "Elimina de la llista",
|
||||||
"lists.delete": "Elimina la llista",
|
"lists.delete": "Elimina la llista",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Show profile anyway",
|
"limited_account_hint.action": "Show profile anyway",
|
||||||
"limited_account_hint.title": "This profile has been hidden by the moderators of {domain}.",
|
"limited_account_hint.title": "This profile has been hidden by the moderators of {domain}.",
|
||||||
"link_preview.author": "By {name}",
|
"link_preview.author": "By {name}",
|
||||||
|
"link_preview.more_from_author": "More from {name}",
|
||||||
"lists.account.add": "Add to list",
|
"lists.account.add": "Add to list",
|
||||||
"lists.account.remove": "Remove from list",
|
"lists.account.remove": "Remove from list",
|
||||||
"lists.delete": "Delete list",
|
"lists.delete": "Delete list",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Mostrar perfil de todos modos",
|
"limited_account_hint.action": "Mostrar perfil de todos modos",
|
||||||
"limited_account_hint.title": "Este perfil fue ocultado por los moderadores de {domain}.",
|
"limited_account_hint.title": "Este perfil fue ocultado por los moderadores de {domain}.",
|
||||||
"link_preview.author": "Por {name}",
|
"link_preview.author": "Por {name}",
|
||||||
|
"link_preview.more_from_author": "Más de {name}",
|
||||||
"lists.account.add": "Agregar a lista",
|
"lists.account.add": "Agregar a lista",
|
||||||
"lists.account.remove": "Quitar de lista",
|
"lists.account.remove": "Quitar de lista",
|
||||||
"lists.delete": "Eliminar lista",
|
"lists.delete": "Eliminar lista",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Näytä profiili joka tapauksessa",
|
"limited_account_hint.action": "Näytä profiili joka tapauksessa",
|
||||||
"limited_account_hint.title": "Palvelimen {domain} valvojat ovat piilottaneet tämän käyttäjätilin.",
|
"limited_account_hint.title": "Palvelimen {domain} valvojat ovat piilottaneet tämän käyttäjätilin.",
|
||||||
"link_preview.author": "Julkaissut {name}",
|
"link_preview.author": "Julkaissut {name}",
|
||||||
|
"link_preview.more_from_author": "Lisää käyttäjältä {name}",
|
||||||
"lists.account.add": "Lisää listalle",
|
"lists.account.add": "Lisää listalle",
|
||||||
"lists.account.remove": "Poista listalta",
|
"lists.account.remove": "Poista listalta",
|
||||||
"lists.delete": "Poista lista",
|
"lists.delete": "Poista lista",
|
||||||
|
|
|
@ -195,8 +195,9 @@
|
||||||
"hashtag.column_header.tag_mode.all": "at {additional}",
|
"hashtag.column_header.tag_mode.all": "at {additional}",
|
||||||
"hashtag.column_header.tag_mode.any": "o {additional}",
|
"hashtag.column_header.tag_mode.any": "o {additional}",
|
||||||
"hashtag.column_settings.tag_mode.all": "Lahat ng nandito",
|
"hashtag.column_settings.tag_mode.all": "Lahat ng nandito",
|
||||||
"hashtag.column_settings.tag_mode.any": "Ilan sa nandito",
|
"hashtag.column_settings.tag_mode.any": "Ilan dito",
|
||||||
"hashtag.column_settings.tag_mode.none": "Wala dito",
|
"hashtag.column_settings.tag_mode.none": "Wala dito",
|
||||||
|
"hashtags.and_other": "…at {count, plural, one {# iba pa} other {# na iba pa}}",
|
||||||
"home.column_settings.show_replies": "Ipakita ang mga tugon",
|
"home.column_settings.show_replies": "Ipakita ang mga tugon",
|
||||||
"home.pending_critical_update.body": "Mangyaring i-update ang iyong serbiro ng Mastodon sa lalong madaling panahon!",
|
"home.pending_critical_update.body": "Mangyaring i-update ang iyong serbiro ng Mastodon sa lalong madaling panahon!",
|
||||||
"interaction_modal.login.action": "Iuwi mo ako",
|
"interaction_modal.login.action": "Iuwi mo ako",
|
||||||
|
@ -224,6 +225,7 @@
|
||||||
"lists.replies_policy.title": "Ipakita ang mga tugon sa:",
|
"lists.replies_policy.title": "Ipakita ang mga tugon sa:",
|
||||||
"lists.subheading": "Iyong mga talaan",
|
"lists.subheading": "Iyong mga talaan",
|
||||||
"loading_indicator.label": "Kumakarga…",
|
"loading_indicator.label": "Kumakarga…",
|
||||||
|
"mute_modal.hide_from_notifications": "Itago mula sa mga abiso",
|
||||||
"navigation_bar.about": "Tungkol dito",
|
"navigation_bar.about": "Tungkol dito",
|
||||||
"navigation_bar.blocks": "Nakaharang na mga tagagamit",
|
"navigation_bar.blocks": "Nakaharang na mga tagagamit",
|
||||||
"navigation_bar.direct": "Mga palihim na banggit",
|
"navigation_bar.direct": "Mga palihim na banggit",
|
||||||
|
@ -233,6 +235,7 @@
|
||||||
"navigation_bar.follow_requests": "Mga hiling sa pagsunod",
|
"navigation_bar.follow_requests": "Mga hiling sa pagsunod",
|
||||||
"navigation_bar.follows_and_followers": "Mga sinusundan at tagasunod",
|
"navigation_bar.follows_and_followers": "Mga sinusundan at tagasunod",
|
||||||
"navigation_bar.lists": "Mga listahan",
|
"navigation_bar.lists": "Mga listahan",
|
||||||
|
"navigation_bar.public_timeline": "Pinagsamang timeline",
|
||||||
"navigation_bar.search": "Maghanap",
|
"navigation_bar.search": "Maghanap",
|
||||||
"notification.admin.report": "Iniulat ni {name} si {target}",
|
"notification.admin.report": "Iniulat ni {name} si {target}",
|
||||||
"notification.follow": "Sinundan ka ni {name}",
|
"notification.follow": "Sinundan ka ni {name}",
|
||||||
|
@ -247,10 +250,12 @@
|
||||||
"notifications.column_settings.alert": "Mga abiso sa Desktop",
|
"notifications.column_settings.alert": "Mga abiso sa Desktop",
|
||||||
"notifications.column_settings.favourite": "Mga paborito:",
|
"notifications.column_settings.favourite": "Mga paborito:",
|
||||||
"notifications.column_settings.follow": "Mga bagong tagasunod:",
|
"notifications.column_settings.follow": "Mga bagong tagasunod:",
|
||||||
|
"notifications.column_settings.poll": "Resulta ng botohan:",
|
||||||
"notifications.column_settings.unread_notifications.category": "Hindi Nabasang mga Abiso",
|
"notifications.column_settings.unread_notifications.category": "Hindi Nabasang mga Abiso",
|
||||||
"notifications.column_settings.update": "Mga pagbago:",
|
"notifications.column_settings.update": "Mga pagbago:",
|
||||||
"notifications.filter.all": "Lahat",
|
"notifications.filter.all": "Lahat",
|
||||||
"notifications.filter.favourites": "Mga paborito",
|
"notifications.filter.favourites": "Mga paborito",
|
||||||
|
"notifications.filter.polls": "Resulta ng botohan",
|
||||||
"notifications.mark_as_read": "Markahan lahat ng abiso bilang nabasa na",
|
"notifications.mark_as_read": "Markahan lahat ng abiso bilang nabasa na",
|
||||||
"notifications.policy.filter_not_followers_title": "Mga taong hindi ka susundan",
|
"notifications.policy.filter_not_followers_title": "Mga taong hindi ka susundan",
|
||||||
"notifications.policy.filter_not_following_title": "Mga taong hindi mo sinusundan",
|
"notifications.policy.filter_not_following_title": "Mga taong hindi mo sinusundan",
|
||||||
|
@ -294,10 +299,13 @@
|
||||||
"report.thanks.title": "Ayaw mo bang makita ito?",
|
"report.thanks.title": "Ayaw mo bang makita ito?",
|
||||||
"report.thanks.title_actionable": "Salamat sa pag-uulat, titingnan namin ito.",
|
"report.thanks.title_actionable": "Salamat sa pag-uulat, titingnan namin ito.",
|
||||||
"report_notification.categories.other": "Iba pa",
|
"report_notification.categories.other": "Iba pa",
|
||||||
|
"report_notification.categories.violation": "Paglabag sa patakaran",
|
||||||
|
"report_notification.open": "Buksan ang ulat",
|
||||||
"search.quick_action.open_url": "Buksan ang URL sa Mastodon",
|
"search.quick_action.open_url": "Buksan ang URL sa Mastodon",
|
||||||
"search.search_or_paste": "Maghanap o ilagay ang URL",
|
"search.search_or_paste": "Maghanap o ilagay ang URL",
|
||||||
"search_popout.full_text_search_disabled_message": "Hindi magagamit sa {domain}.",
|
"search_popout.full_text_search_disabled_message": "Hindi magagamit sa {domain}.",
|
||||||
"search_popout.full_text_search_logged_out_message": "Magagamit lamang kapag naka-log in.",
|
"search_popout.full_text_search_logged_out_message": "Magagamit lamang kapag naka-log in.",
|
||||||
|
"search_popout.recent": "Kamakailang mga paghahanap",
|
||||||
"search_results.all": "Lahat",
|
"search_results.all": "Lahat",
|
||||||
"search_results.see_all": "Ipakita lahat",
|
"search_results.see_all": "Ipakita lahat",
|
||||||
"server_banner.learn_more": "Matuto nang higit pa",
|
"server_banner.learn_more": "Matuto nang higit pa",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Mostrar perfil igualmente",
|
"limited_account_hint.action": "Mostrar perfil igualmente",
|
||||||
"limited_account_hint.title": "Este perfil foi agochado pola moderación de {domain}.",
|
"limited_account_hint.title": "Este perfil foi agochado pola moderación de {domain}.",
|
||||||
"link_preview.author": "Por {name}",
|
"link_preview.author": "Por {name}",
|
||||||
|
"link_preview.more_from_author": "Máis de {name}",
|
||||||
"lists.account.add": "Engadir á listaxe",
|
"lists.account.add": "Engadir á listaxe",
|
||||||
"lists.account.remove": "Eliminar da listaxe",
|
"lists.account.remove": "Eliminar da listaxe",
|
||||||
"lists.delete": "Eliminar listaxe",
|
"lists.delete": "Eliminar listaxe",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Mostra comunque il profilo",
|
"limited_account_hint.action": "Mostra comunque il profilo",
|
||||||
"limited_account_hint.title": "Questo profilo è stato nascosto dai moderatori di {domain}.",
|
"limited_account_hint.title": "Questo profilo è stato nascosto dai moderatori di {domain}.",
|
||||||
"link_preview.author": "Di {name}",
|
"link_preview.author": "Di {name}",
|
||||||
|
"link_preview.more_from_author": "Altro da {name}",
|
||||||
"lists.account.add": "Aggiungi all'elenco",
|
"lists.account.add": "Aggiungi all'elenco",
|
||||||
"lists.account.remove": "Rimuovi dall'elenco",
|
"lists.account.remove": "Rimuovi dall'elenco",
|
||||||
"lists.delete": "Elimina elenco",
|
"lists.delete": "Elimina elenco",
|
||||||
|
|
|
@ -234,7 +234,7 @@
|
||||||
"embed.preview": "이렇게 표시됩니다:",
|
"embed.preview": "이렇게 표시됩니다:",
|
||||||
"emoji_button.activity": "활동",
|
"emoji_button.activity": "활동",
|
||||||
"emoji_button.clear": "지우기",
|
"emoji_button.clear": "지우기",
|
||||||
"emoji_button.custom": "사용자 지정",
|
"emoji_button.custom": "커스텀",
|
||||||
"emoji_button.flags": "깃발",
|
"emoji_button.flags": "깃발",
|
||||||
"emoji_button.food": "음식과 마실것",
|
"emoji_button.food": "음식과 마실것",
|
||||||
"emoji_button.label": "에모지 추가",
|
"emoji_button.label": "에모지 추가",
|
||||||
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "그래도 프로필 보기",
|
"limited_account_hint.action": "그래도 프로필 보기",
|
||||||
"limited_account_hint.title": "이 프로필은 {domain}의 중재자에 의해 숨겨진 상태입니다.",
|
"limited_account_hint.title": "이 프로필은 {domain}의 중재자에 의해 숨겨진 상태입니다.",
|
||||||
"link_preview.author": "{name}",
|
"link_preview.author": "{name}",
|
||||||
|
"link_preview.more_from_author": "{name} 더 둘러보기",
|
||||||
"lists.account.add": "리스트에 추가",
|
"lists.account.add": "리스트에 추가",
|
||||||
"lists.account.remove": "리스트에서 제거",
|
"lists.account.remove": "리스트에서 제거",
|
||||||
"lists.delete": "리스트 삭제",
|
"lists.delete": "리스트 삭제",
|
||||||
|
|
|
@ -466,6 +466,7 @@
|
||||||
"notification.follow_request": "{name} paprašė tave sekti",
|
"notification.follow_request": "{name} paprašė tave sekti",
|
||||||
"notification.mention": "{name} paminėjo tave",
|
"notification.mention": "{name} paminėjo tave",
|
||||||
"notification.moderation-warning.learn_more": "Sužinoti daugiau",
|
"notification.moderation-warning.learn_more": "Sužinoti daugiau",
|
||||||
|
"notification.moderation_warning": "Gavai prižiūrėjimo įspėjimą",
|
||||||
"notification.moderation_warning.action_delete_statuses": "Kai kurie tavo įrašai buvo pašalintos.",
|
"notification.moderation_warning.action_delete_statuses": "Kai kurie tavo įrašai buvo pašalintos.",
|
||||||
"notification.moderation_warning.action_disable": "Tavo paskyra buvo išjungta.",
|
"notification.moderation_warning.action_disable": "Tavo paskyra buvo išjungta.",
|
||||||
"notification.moderation_warning.action_mark_statuses_as_sensitive": "Kai kurie tavo įrašai buvo pažymėtos kaip jautrios.",
|
"notification.moderation_warning.action_mark_statuses_as_sensitive": "Kai kurie tavo įrašai buvo pažymėtos kaip jautrios.",
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
"attachments_list.unprocessed": "(neapstrādāti)",
|
"attachments_list.unprocessed": "(neapstrādāti)",
|
||||||
"audio.hide": "Slēpt audio",
|
"audio.hide": "Slēpt audio",
|
||||||
"block_modal.remote_users_caveat": "Mēs vaicāsim serverim {domain} ņemt vērā Tavu lēmumu. Tomēr atbilstība nav nodrošināta, jo atsevišķi serveri var apstrādāt bloķēšanu citādi. Publiski ieraksti joprojām var būt redzami lietotājiem, kuri nav pieteikušies.",
|
"block_modal.remote_users_caveat": "Mēs vaicāsim serverim {domain} ņemt vērā Tavu lēmumu. Tomēr atbilstība nav nodrošināta, jo atsevišķi serveri var apstrādāt bloķēšanu citādi. Publiski ieraksti joprojām var būt redzami lietotājiem, kuri nav pieteikušies.",
|
||||||
"block_modal.show_less": "Parādīt vairāk",
|
"block_modal.show_less": "Rādīt mazāk",
|
||||||
"block_modal.show_more": "Parādīt mazāk",
|
"block_modal.show_more": "Parādīt mazāk",
|
||||||
"boost_modal.combo": "Nospied {combo}, lai nākamreiz šo izlaistu",
|
"boost_modal.combo": "Nospied {combo}, lai nākamreiz šo izlaistu",
|
||||||
"bundle_column_error.copy_stacktrace": "Kopēt kļūdu ziņojumu",
|
"bundle_column_error.copy_stacktrace": "Kopēt kļūdu ziņojumu",
|
||||||
|
@ -309,7 +309,7 @@
|
||||||
"hashtag.counter_by_uses_today": "{count, plural, zero {{counter} ierakstu} one {{counter} ieraksts} other {{counter} ieraksti}} šodien",
|
"hashtag.counter_by_uses_today": "{count, plural, zero {{counter} ierakstu} one {{counter} ieraksts} other {{counter} ieraksti}} šodien",
|
||||||
"hashtag.follow": "Sekot tēmturim",
|
"hashtag.follow": "Sekot tēmturim",
|
||||||
"hashtag.unfollow": "Pārstāt sekot tēmturim",
|
"hashtag.unfollow": "Pārstāt sekot tēmturim",
|
||||||
"hashtags.and_other": "..un {count, plural, other {# vairāk}}",
|
"hashtags.and_other": "… un {count, plural, other {vēl #}}",
|
||||||
"home.column_settings.show_reblogs": "Rādīt pastiprinātos ierakstus",
|
"home.column_settings.show_reblogs": "Rādīt pastiprinātos ierakstus",
|
||||||
"home.column_settings.show_replies": "Rādīt atbildes",
|
"home.column_settings.show_replies": "Rādīt atbildes",
|
||||||
"home.hide_announcements": "Slēpt paziņojumus",
|
"home.hide_announcements": "Slēpt paziņojumus",
|
||||||
|
@ -491,7 +491,7 @@
|
||||||
"onboarding.actions.go_to_home": "Dodieties uz manu mājas plūsmu",
|
"onboarding.actions.go_to_home": "Dodieties uz manu mājas plūsmu",
|
||||||
"onboarding.compose.template": "Sveiki, #Mastodon!",
|
"onboarding.compose.template": "Sveiki, #Mastodon!",
|
||||||
"onboarding.follows.empty": "Diemžēl pašlaik nevar parādīt rezultātus. Vari mēģināt izmantot meklēšanu vai pārlūkot izpētes lapu, lai atrastu cilvēkus, kuriem sekot, vai vēlāk mēģināt vēlreiz.",
|
"onboarding.follows.empty": "Diemžēl pašlaik nevar parādīt rezultātus. Vari mēģināt izmantot meklēšanu vai pārlūkot izpētes lapu, lai atrastu cilvēkus, kuriem sekot, vai vēlāk mēģināt vēlreiz.",
|
||||||
"onboarding.follows.lead": "Tava mājas plūsma ir galvenais veids, kā izbaudīt Mastodon. Jo vairāk cilvēku sekosi, jo aktīvāk un interesantāk tas būs. Lai sāktu, šeit ir daži ieteikumi:",
|
"onboarding.follows.lead": "Tava mājas plūsma ir galvenais veids, kā pieredzēt Mastodon. Jo vairāk cilvēkiem sekosi, jo dzīvīgāka un aizraujošāka tā būs. Lai sāktu, šeit ir daži ieteikumi:",
|
||||||
"onboarding.follows.title": "Pielāgo savu mājas barotni",
|
"onboarding.follows.title": "Pielāgo savu mājas barotni",
|
||||||
"onboarding.profile.discoverable": "Padarīt manu profilu atklājamu",
|
"onboarding.profile.discoverable": "Padarīt manu profilu atklājamu",
|
||||||
"onboarding.profile.display_name": "Attēlojamais vārds",
|
"onboarding.profile.display_name": "Attēlojamais vārds",
|
||||||
|
|
|
@ -297,6 +297,7 @@
|
||||||
"filter_modal.select_filter.subtitle": "Bruk ein eksisterande kategori eller opprett ein ny",
|
"filter_modal.select_filter.subtitle": "Bruk ein eksisterande kategori eller opprett ein ny",
|
||||||
"filter_modal.select_filter.title": "Filtrer dette innlegget",
|
"filter_modal.select_filter.title": "Filtrer dette innlegget",
|
||||||
"filter_modal.title.status": "Filtrer eit innlegg",
|
"filter_modal.title.status": "Filtrer eit innlegg",
|
||||||
|
"filtered_notifications_banner.mentions": "{count, plural, one {omtale} other {omtaler}}",
|
||||||
"filtered_notifications_banner.pending_requests": "Varsel frå {count, plural, =0 {ingen} one {ein person} other {# folk}} du kanskje kjenner",
|
"filtered_notifications_banner.pending_requests": "Varsel frå {count, plural, =0 {ingen} one {ein person} other {# folk}} du kanskje kjenner",
|
||||||
"filtered_notifications_banner.title": "Filtrerte varslingar",
|
"filtered_notifications_banner.title": "Filtrerte varslingar",
|
||||||
"firehose.all": "Alle",
|
"firehose.all": "Alle",
|
||||||
|
@ -307,6 +308,8 @@
|
||||||
"follow_requests.unlocked_explanation": "Sjølv om kontoen din ikkje er låst tenkte dei som driv {domain} at du kanskje ville gå gjennom førespurnadar frå desse kontoane manuelt.",
|
"follow_requests.unlocked_explanation": "Sjølv om kontoen din ikkje er låst tenkte dei som driv {domain} at du kanskje ville gå gjennom førespurnadar frå desse kontoane manuelt.",
|
||||||
"follow_suggestions.curated_suggestion": "Utvalt av staben",
|
"follow_suggestions.curated_suggestion": "Utvalt av staben",
|
||||||
"follow_suggestions.dismiss": "Ikkje vis igjen",
|
"follow_suggestions.dismiss": "Ikkje vis igjen",
|
||||||
|
"follow_suggestions.featured_longer": "Hanplukka av gjengen på {domain}",
|
||||||
|
"follow_suggestions.friends_of_friends_longer": "Populært hjå dei du fylgjer",
|
||||||
"follow_suggestions.hints.featured": "Denne profilen er handplukka av folka på {domain}.",
|
"follow_suggestions.hints.featured": "Denne profilen er handplukka av folka på {domain}.",
|
||||||
"follow_suggestions.hints.friends_of_friends": "Denne profilen er populær hjå dei du fylgjer.",
|
"follow_suggestions.hints.friends_of_friends": "Denne profilen er populær hjå dei du fylgjer.",
|
||||||
"follow_suggestions.hints.most_followed": "Mange på {domain} fylgjer denne profilen.",
|
"follow_suggestions.hints.most_followed": "Mange på {domain} fylgjer denne profilen.",
|
||||||
|
@ -314,6 +317,8 @@
|
||||||
"follow_suggestions.hints.similar_to_recently_followed": "Denne profilen liknar på dei andre profilane du har fylgt i det siste.",
|
"follow_suggestions.hints.similar_to_recently_followed": "Denne profilen liknar på dei andre profilane du har fylgt i det siste.",
|
||||||
"follow_suggestions.personalized_suggestion": "Personleg forslag",
|
"follow_suggestions.personalized_suggestion": "Personleg forslag",
|
||||||
"follow_suggestions.popular_suggestion": "Populært forslag",
|
"follow_suggestions.popular_suggestion": "Populært forslag",
|
||||||
|
"follow_suggestions.popular_suggestion_longer": "Populært på {domain}",
|
||||||
|
"follow_suggestions.similar_to_recently_followed_longer": "Liknar på profilar du har fylgt i det siste",
|
||||||
"follow_suggestions.view_all": "Vis alle",
|
"follow_suggestions.view_all": "Vis alle",
|
||||||
"follow_suggestions.who_to_follow": "Kven du kan fylgja",
|
"follow_suggestions.who_to_follow": "Kven du kan fylgja",
|
||||||
"followed_tags": "Fylgde emneknaggar",
|
"followed_tags": "Fylgde emneknaggar",
|
||||||
|
@ -668,7 +673,7 @@
|
||||||
"search.quick_action.account_search": "Profiler som samsvarer med {x}",
|
"search.quick_action.account_search": "Profiler som samsvarer med {x}",
|
||||||
"search.quick_action.go_to_account": "Gå til profil {x}",
|
"search.quick_action.go_to_account": "Gå til profil {x}",
|
||||||
"search.quick_action.go_to_hashtag": "Gå til emneknagg {x}",
|
"search.quick_action.go_to_hashtag": "Gå til emneknagg {x}",
|
||||||
"search.quick_action.open_url": "Åpne URL i Mastodon",
|
"search.quick_action.open_url": "Opne adressa i Mastodon",
|
||||||
"search.quick_action.status_search": "Innlegg som samsvarer med {x}",
|
"search.quick_action.status_search": "Innlegg som samsvarer med {x}",
|
||||||
"search.search_or_paste": "Søk eller lim inn URL",
|
"search.search_or_paste": "Søk eller lim inn URL",
|
||||||
"search_popout.full_text_search_disabled_message": "Ikkje tilgjengeleg på {domain}.",
|
"search_popout.full_text_search_disabled_message": "Ikkje tilgjengeleg på {domain}.",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Pokaż profil mimo to",
|
"limited_account_hint.action": "Pokaż profil mimo to",
|
||||||
"limited_account_hint.title": "Ten profil został ukryty przez moderatorów {domain}.",
|
"limited_account_hint.title": "Ten profil został ukryty przez moderatorów {domain}.",
|
||||||
"link_preview.author": "{name}",
|
"link_preview.author": "{name}",
|
||||||
|
"link_preview.more_from_author": "Więcej od {name}",
|
||||||
"lists.account.add": "Dodaj do listy",
|
"lists.account.add": "Dodaj do listy",
|
||||||
"lists.account.remove": "Usunąć z listy",
|
"lists.account.remove": "Usunąć z listy",
|
||||||
"lists.delete": "Usuń listę",
|
"lists.delete": "Usuń listę",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Exibir perfil mesmo assim",
|
"limited_account_hint.action": "Exibir perfil mesmo assim",
|
||||||
"limited_account_hint.title": "Este perfil foi ocultado pelos moderadores do {domain}.",
|
"limited_account_hint.title": "Este perfil foi ocultado pelos moderadores do {domain}.",
|
||||||
"link_preview.author": "Por {name}",
|
"link_preview.author": "Por {name}",
|
||||||
|
"link_preview.more_from_author": "Mais de {name}",
|
||||||
"lists.account.add": "Adicionar à lista",
|
"lists.account.add": "Adicionar à lista",
|
||||||
"lists.account.remove": "Remover da lista",
|
"lists.account.remove": "Remover da lista",
|
||||||
"lists.delete": "Excluir lista",
|
"lists.delete": "Excluir lista",
|
||||||
|
@ -474,6 +475,7 @@
|
||||||
"notification.follow_request": "{name} quer te seguir",
|
"notification.follow_request": "{name} quer te seguir",
|
||||||
"notification.mention": "{name} te mencionou",
|
"notification.mention": "{name} te mencionou",
|
||||||
"notification.moderation-warning.learn_more": "Aprender mais",
|
"notification.moderation-warning.learn_more": "Aprender mais",
|
||||||
|
"notification.moderation_warning": "Você recebeu um aviso de moderação",
|
||||||
"notification.moderation_warning.action_delete_statuses": "Algumas das suas publicações foram removidas.",
|
"notification.moderation_warning.action_delete_statuses": "Algumas das suas publicações foram removidas.",
|
||||||
"notification.moderation_warning.action_disable": "Sua conta foi desativada.",
|
"notification.moderation_warning.action_disable": "Sua conta foi desativada.",
|
||||||
"notification.moderation_warning.action_mark_statuses_as_sensitive": "Algumas de suas publicações foram marcadas por ter conteúdo sensível.",
|
"notification.moderation_warning.action_mark_statuses_as_sensitive": "Algumas de suas publicações foram marcadas por ter conteúdo sensível.",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Exibir perfil mesmo assim",
|
"limited_account_hint.action": "Exibir perfil mesmo assim",
|
||||||
"limited_account_hint.title": "Este perfil foi ocultado pelos moderadores de {domain}.",
|
"limited_account_hint.title": "Este perfil foi ocultado pelos moderadores de {domain}.",
|
||||||
"link_preview.author": "Por {name}",
|
"link_preview.author": "Por {name}",
|
||||||
|
"link_preview.more_from_author": "Mais de {name}",
|
||||||
"lists.account.add": "Adicionar à lista",
|
"lists.account.add": "Adicionar à lista",
|
||||||
"lists.account.remove": "Remover da lista",
|
"lists.account.remove": "Remover da lista",
|
||||||
"lists.delete": "Eliminar lista",
|
"lists.delete": "Eliminar lista",
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
"account.edit_profile": "පැතිකඩ සංස්කරණය",
|
"account.edit_profile": "පැතිකඩ සංස්කරණය",
|
||||||
"account.enable_notifications": "@{name} පළ කරන විට මට දැනුම් දෙන්න",
|
"account.enable_notifications": "@{name} පළ කරන විට මට දැනුම් දෙන්න",
|
||||||
"account.endorse": "පැතිකඩෙහි විශේෂාංගය",
|
"account.endorse": "පැතිකඩෙහි විශේෂාංගය",
|
||||||
|
"account.featured_tags.last_status_at": "අවසාන ලිපිය: {date}",
|
||||||
"account.featured_tags.last_status_never": "ලිපි නැත",
|
"account.featured_tags.last_status_never": "ලිපි නැත",
|
||||||
"account.follow": "අනුගමනය",
|
"account.follow": "අනුගමනය",
|
||||||
"account.followers": "අනුගාමිකයින්",
|
"account.followers": "අනුගාමිකයින්",
|
||||||
|
@ -104,6 +105,7 @@
|
||||||
"compose_form.poll.duration": "මත විමසීමේ කාලය",
|
"compose_form.poll.duration": "මත විමසීමේ කාලය",
|
||||||
"compose_form.poll.switch_to_multiple": "තේරීම් කිහිපයකට මත විමසුම වෙනස් කරන්න",
|
"compose_form.poll.switch_to_multiple": "තේරීම් කිහිපයකට මත විමසුම වෙනස් කරන්න",
|
||||||
"compose_form.poll.switch_to_single": "තනි තේරීමකට මත විමසුම වෙනස් කරන්න",
|
"compose_form.poll.switch_to_single": "තනි තේරීමකට මත විමසුම වෙනස් කරන්න",
|
||||||
|
"compose_form.publish": "ප්රකාශනය",
|
||||||
"compose_form.publish_form": "නව ලිපිය",
|
"compose_form.publish_form": "නව ලිපිය",
|
||||||
"compose_form.spoiler.marked": "අන්තර්ගත අවවාදය ඉවත් කරන්න",
|
"compose_form.spoiler.marked": "අන්තර්ගත අවවාදය ඉවත් කරන්න",
|
||||||
"compose_form.spoiler.unmarked": "අන්තර්ගත අවවාදයක් එක් කරන්න",
|
"compose_form.spoiler.unmarked": "අන්තර්ගත අවවාදයක් එක් කරන්න",
|
||||||
|
@ -154,6 +156,7 @@
|
||||||
"empty_column.bookmarked_statuses": "ඔබ සතුව පොත්යොමු තබන ලද ලිපි කිසිවක් නැත. ඔබ පොත්යොමුවක් තබන විට, එය මෙහි දිස්වනු ඇත.",
|
"empty_column.bookmarked_statuses": "ඔබ සතුව පොත්යොමු තබන ලද ලිපි කිසිවක් නැත. ඔබ පොත්යොමුවක් තබන විට, එය මෙහි දිස්වනු ඇත.",
|
||||||
"empty_column.domain_blocks": "අවහිර කරන ලද වසම් නැත.",
|
"empty_column.domain_blocks": "අවහිර කරන ලද වසම් නැත.",
|
||||||
"empty_column.explore_statuses": "දැන් කිසිවක් නැඹුරු නොවේ. පසුව නැවත පරීක්ෂා කරන්න!",
|
"empty_column.explore_statuses": "දැන් කිසිවක් නැඹුරු නොවේ. පසුව නැවත පරීක්ෂා කරන්න!",
|
||||||
|
"empty_column.favourited_statuses": "ඔබ සතුව ප්රියතම ලිපි කිසිවක් නැත. ඔබ යමකට ප්රිය කළ විට එය මෙහි පෙන්වනු ඇත.",
|
||||||
"empty_column.follow_requests": "ඔබට තවමත් අනුගමන ඉල්ලීම් ලැබී නැත. ඉල්ලීමක් ලැබුණු විට, එය මෙහි පෙන්වනු ඇත.",
|
"empty_column.follow_requests": "ඔබට තවමත් අනුගමන ඉල්ලීම් ලැබී නැත. ඉල්ලීමක් ලැබුණු විට, එය මෙහි පෙන්වනු ඇත.",
|
||||||
"empty_column.home": "මුල් පිටුව හිස් ය! මෙය පිරවීමට බොහෝ පුද්ගලයින් අනුගමනය කරන්න.",
|
"empty_column.home": "මුල් පිටුව හිස් ය! මෙය පිරවීමට බොහෝ පුද්ගලයින් අනුගමනය කරන්න.",
|
||||||
"empty_column.lists": "ඔබට තවමත් ලැයිස්තු කිසිවක් නැත. ඔබ එකක් සාදන විට, එය මෙහි පෙන්වනු ඇත.",
|
"empty_column.lists": "ඔබට තවමත් ලැයිස්තු කිසිවක් නැත. ඔබ එකක් සාදන විට, එය මෙහි පෙන්වනු ඇත.",
|
||||||
|
@ -205,6 +208,7 @@
|
||||||
"interaction_modal.on_this_server": "මෙම සේවාදායකයෙහි",
|
"interaction_modal.on_this_server": "මෙම සේවාදායකයෙහි",
|
||||||
"interaction_modal.title.favourite": "{name}ගේ ලිපිය ප්රිය කරන්න",
|
"interaction_modal.title.favourite": "{name}ගේ ලිපිය ප්රිය කරන්න",
|
||||||
"interaction_modal.title.follow": "{name} අනුගමනය",
|
"interaction_modal.title.follow": "{name} අනුගමනය",
|
||||||
|
"interaction_modal.title.reply": "{name}ගේ ලිපියට පිළිතුරු",
|
||||||
"intervals.full.days": "{number, plural, one {දවස් #} other {දවස් #}}",
|
"intervals.full.days": "{number, plural, one {දවස් #} other {දවස් #}}",
|
||||||
"intervals.full.hours": "{number, plural, one {පැය #} other {පැය #}}",
|
"intervals.full.hours": "{number, plural, one {පැය #} other {පැය #}}",
|
||||||
"intervals.full.minutes": "{number, plural, one {විනාඩි #} other {විනාඩි #}}",
|
"intervals.full.minutes": "{number, plural, one {විනාඩි #} other {විනාඩි #}}",
|
||||||
|
@ -239,6 +243,7 @@
|
||||||
"lists.delete": "ලැයිස්තුව මකන්න",
|
"lists.delete": "ලැයිස්තුව මකන්න",
|
||||||
"lists.edit": "ලැයිස්තුව සංස්කරණය",
|
"lists.edit": "ලැයිස්තුව සංස්කරණය",
|
||||||
"lists.edit.submit": "සිරැසිය සංශෝධනය",
|
"lists.edit.submit": "සිරැසිය සංශෝධනය",
|
||||||
|
"lists.new.create": "එකතු",
|
||||||
"lists.new.title_placeholder": "නව ලැයිස්තුවේ සිරැසිය",
|
"lists.new.title_placeholder": "නව ලැයිස්තුවේ සිරැසිය",
|
||||||
"lists.replies_policy.list": "ලැයිස්තුවේ සාමාජිකයින්",
|
"lists.replies_policy.list": "ලැයිස්තුවේ සාමාජිකයින්",
|
||||||
"lists.replies_policy.none": "කිසිවෙක් නැත",
|
"lists.replies_policy.none": "කිසිවෙක් නැත",
|
||||||
|
@ -266,6 +271,7 @@
|
||||||
"navigation_bar.search": "සොයන්න",
|
"navigation_bar.search": "සොයන්න",
|
||||||
"navigation_bar.security": "ආරක්ෂාව",
|
"navigation_bar.security": "ආරක්ෂාව",
|
||||||
"not_signed_in_indicator.not_signed_in": "You need to sign in to access this resource.",
|
"not_signed_in_indicator.not_signed_in": "You need to sign in to access this resource.",
|
||||||
|
"notification.favourite": "{name} ඔබගේ ලිපියට ප්රිය කළා",
|
||||||
"notification.follow": "{name} ඔබව අනුගමනය කළා",
|
"notification.follow": "{name} ඔබව අනුගමනය කළා",
|
||||||
"notification.mention": "{name} ඔබව සඳහන් කර ඇත",
|
"notification.mention": "{name} ඔබව සඳහන් කර ඇත",
|
||||||
"notification.own_poll": "ඔබගේ මත විමසුම නිමයි",
|
"notification.own_poll": "ඔබගේ මත විමසුම නිමයි",
|
||||||
|
@ -395,6 +401,7 @@
|
||||||
"status.admin_status": "මෙම ලිපිය මැදිහත්කරණ අතුරුමුහුණතෙහි අරින්න",
|
"status.admin_status": "මෙම ලිපිය මැදිහත්කරණ අතුරුමුහුණතෙහි අරින්න",
|
||||||
"status.block": "@{name} අවහිර",
|
"status.block": "@{name} අවහිර",
|
||||||
"status.bookmark": "පොත්යොමුවක්",
|
"status.bookmark": "පොත්යොමුවක්",
|
||||||
|
"status.copy": "ලිපියට සබැඳියේ පිටපතක්",
|
||||||
"status.delete": "මකන්න",
|
"status.delete": "මකන්න",
|
||||||
"status.detailed_status": "විස්තරාත්මක සංවාද දැක්ම",
|
"status.detailed_status": "විස්තරාත්මක සංවාද දැක්ම",
|
||||||
"status.edit": "සංස්කරණය",
|
"status.edit": "සංස්කරණය",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Vseeno pokaži profil",
|
"limited_account_hint.action": "Vseeno pokaži profil",
|
||||||
"limited_account_hint.title": "Profil so moderatorji strežnika {domain} skrili.",
|
"limited_account_hint.title": "Profil so moderatorji strežnika {domain} skrili.",
|
||||||
"link_preview.author": "Avtor_ica {name}",
|
"link_preview.author": "Avtor_ica {name}",
|
||||||
|
"link_preview.more_from_author": "Več od {name}",
|
||||||
"lists.account.add": "Dodaj na seznam",
|
"lists.account.add": "Dodaj na seznam",
|
||||||
"lists.account.remove": "Odstrani s seznama",
|
"lists.account.remove": "Odstrani s seznama",
|
||||||
"lists.delete": "Izbriši seznam",
|
"lists.delete": "Izbriši seznam",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "Vẫn cứ xem",
|
"limited_account_hint.action": "Vẫn cứ xem",
|
||||||
"limited_account_hint.title": "Người này đã bị ẩn bởi quản trị viên của {domain}.",
|
"limited_account_hint.title": "Người này đã bị ẩn bởi quản trị viên của {domain}.",
|
||||||
"link_preview.author": "Bởi {name}",
|
"link_preview.author": "Bởi {name}",
|
||||||
|
"link_preview.more_from_author": "Thêm từ {name}",
|
||||||
"lists.account.add": "Thêm vào danh sách",
|
"lists.account.add": "Thêm vào danh sách",
|
||||||
"lists.account.remove": "Xóa khỏi danh sách",
|
"lists.account.remove": "Xóa khỏi danh sách",
|
||||||
"lists.delete": "Xóa danh sách",
|
"lists.delete": "Xóa danh sách",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "仍要显示个人资料",
|
"limited_account_hint.action": "仍要显示个人资料",
|
||||||
"limited_account_hint.title": "此账号资料已被 {domain} 管理员隐藏。",
|
"limited_account_hint.title": "此账号资料已被 {domain} 管理员隐藏。",
|
||||||
"link_preview.author": "由 {name}",
|
"link_preview.author": "由 {name}",
|
||||||
|
"link_preview.more_from_author": "查看 {name} 的更多内容",
|
||||||
"lists.account.add": "添加到列表",
|
"lists.account.add": "添加到列表",
|
||||||
"lists.account.remove": "从列表中移除",
|
"lists.account.remove": "从列表中移除",
|
||||||
"lists.delete": "删除列表",
|
"lists.delete": "删除列表",
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
"limited_account_hint.action": "一律顯示個人檔案",
|
"limited_account_hint.action": "一律顯示個人檔案",
|
||||||
"limited_account_hint.title": "此個人檔案已被 {domain} 的管理員隱藏。",
|
"limited_account_hint.title": "此個人檔案已被 {domain} 的管理員隱藏。",
|
||||||
"link_preview.author": "來自 {name}",
|
"link_preview.author": "來自 {name}",
|
||||||
|
"link_preview.more_from_author": "來自 {name} 之更多內容",
|
||||||
"lists.account.add": "新增至列表",
|
"lists.account.add": "新增至列表",
|
||||||
"lists.account.remove": "自列表中移除",
|
"lists.account.remove": "自列表中移除",
|
||||||
"lists.delete": "刪除列表",
|
"lists.delete": "刪除列表",
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { layoutFromWindow } from 'mastodon/is_mobile';
|
||||||
|
|
||||||
const initialState = ImmutableMap({
|
const initialState = ImmutableMap({
|
||||||
streaming_api_base_url: null,
|
streaming_api_base_url: null,
|
||||||
access_token: null,
|
|
||||||
layout: layoutFromWindow(),
|
layout: layoutFromWindow(),
|
||||||
permissions: '0',
|
permissions: '0',
|
||||||
});
|
});
|
||||||
|
@ -14,7 +13,8 @@ const initialState = ImmutableMap({
|
||||||
export default function meta(state = initialState, action) {
|
export default function meta(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case STORE_HYDRATE:
|
case STORE_HYDRATE:
|
||||||
return state.merge(action.state.get('meta')).set('permissions', action.state.getIn(['role', 'permissions']));
|
// we do not want `access_token` to be stored in the state
|
||||||
|
return state.merge(action.state.get('meta')).delete('access_token').set('permissions', action.state.getIn(['role', 'permissions']));
|
||||||
case changeLayout.type:
|
case changeLayout.type:
|
||||||
return state.set('layout', action.payload.layout);
|
return state.set('layout', action.payload.layout);
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -3,10 +3,6 @@ import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||||
import { STATUS_IMPORT, STATUSES_IMPORT } from '../actions/importer';
|
import { STATUS_IMPORT, STATUSES_IMPORT } from '../actions/importer';
|
||||||
import { normalizeStatusTranslation } from '../actions/importer/normalizer';
|
import { normalizeStatusTranslation } from '../actions/importer/normalizer';
|
||||||
import {
|
import {
|
||||||
REBLOG_REQUEST,
|
|
||||||
REBLOG_FAIL,
|
|
||||||
UNREBLOG_REQUEST,
|
|
||||||
UNREBLOG_FAIL,
|
|
||||||
FAVOURITE_REQUEST,
|
FAVOURITE_REQUEST,
|
||||||
FAVOURITE_FAIL,
|
FAVOURITE_FAIL,
|
||||||
UNFAVOURITE_REQUEST,
|
UNFAVOURITE_REQUEST,
|
||||||
|
@ -16,6 +12,10 @@ import {
|
||||||
UNBOOKMARK_REQUEST,
|
UNBOOKMARK_REQUEST,
|
||||||
UNBOOKMARK_FAIL,
|
UNBOOKMARK_FAIL,
|
||||||
} from '../actions/interactions';
|
} from '../actions/interactions';
|
||||||
|
import {
|
||||||
|
reblog,
|
||||||
|
unreblog,
|
||||||
|
} from '../actions/interactions_typed';
|
||||||
import {
|
import {
|
||||||
STATUS_MUTE_SUCCESS,
|
STATUS_MUTE_SUCCESS,
|
||||||
STATUS_UNMUTE_SUCCESS,
|
STATUS_UNMUTE_SUCCESS,
|
||||||
|
@ -65,6 +65,7 @@ const statusTranslateUndo = (state, id) => {
|
||||||
|
|
||||||
const initialState = ImmutableMap();
|
const initialState = ImmutableMap();
|
||||||
|
|
||||||
|
/** @type {import('@reduxjs/toolkit').Reducer<typeof initialState>} */
|
||||||
export default function statuses(state = initialState, action) {
|
export default function statuses(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case STATUS_FETCH_REQUEST:
|
case STATUS_FETCH_REQUEST:
|
||||||
|
@ -91,14 +92,6 @@ export default function statuses(state = initialState, action) {
|
||||||
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'bookmarked'], false);
|
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'bookmarked'], false);
|
||||||
case UNBOOKMARK_FAIL:
|
case UNBOOKMARK_FAIL:
|
||||||
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'bookmarked'], true);
|
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'bookmarked'], true);
|
||||||
case REBLOG_REQUEST:
|
|
||||||
return state.setIn([action.status.get('id'), 'reblogged'], true);
|
|
||||||
case REBLOG_FAIL:
|
|
||||||
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], false);
|
|
||||||
case UNREBLOG_REQUEST:
|
|
||||||
return state.setIn([action.status.get('id'), 'reblogged'], false);
|
|
||||||
case UNREBLOG_FAIL:
|
|
||||||
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], true);
|
|
||||||
case STATUS_MUTE_SUCCESS:
|
case STATUS_MUTE_SUCCESS:
|
||||||
return state.setIn([action.id, 'muted'], true);
|
return state.setIn([action.id, 'muted'], true);
|
||||||
case STATUS_UNMUTE_SUCCESS:
|
case STATUS_UNMUTE_SUCCESS:
|
||||||
|
@ -128,6 +121,15 @@ export default function statuses(state = initialState, action) {
|
||||||
case STATUS_TRANSLATE_UNDO:
|
case STATUS_TRANSLATE_UNDO:
|
||||||
return statusTranslateUndo(state, action.id);
|
return statusTranslateUndo(state, action.id);
|
||||||
default:
|
default:
|
||||||
return state;
|
if(reblog.pending.match(action))
|
||||||
|
return state.setIn([action.meta.arg.statusId, 'reblogged'], true);
|
||||||
|
else if(reblog.rejected.match(action))
|
||||||
|
return state.get(action.meta.arg.statusId) === undefined ? state : state.setIn([action.meta.arg.statusId, 'reblogged'], false);
|
||||||
|
else if(unreblog.pending.match(action))
|
||||||
|
return state.setIn([action.meta.arg.statusId, 'reblogged'], false);
|
||||||
|
else if(unreblog.rejected.match(action))
|
||||||
|
return state.get(action.meta.arg.statusId) === undefined ? state : state.setIn([action.meta.arg.statusId, 'reblogged'], true);
|
||||||
|
else
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,9 @@ export const soundsMiddleware = (): Middleware<
|
||||||
if (isActionWithMetaSound(action)) {
|
if (isActionWithMetaSound(action)) {
|
||||||
const sound = action.meta.sound;
|
const sound = action.meta.sound;
|
||||||
|
|
||||||
if (sound && Object.hasOwn(soundCache, sound)) {
|
if (sound) {
|
||||||
play(soundCache[sound]);
|
const s = soundCache[sound];
|
||||||
|
if (s) play(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ import { createAsyncThunk } from '@reduxjs/toolkit';
|
||||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
|
||||||
|
import type { BaseThunkAPI } from '@reduxjs/toolkit/dist/createAsyncThunk';
|
||||||
|
|
||||||
import type { AppDispatch, RootState } from './store';
|
import type { AppDispatch, RootState } from './store';
|
||||||
|
|
||||||
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
|
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
|
||||||
|
@ -13,8 +15,185 @@ export interface AsyncThunkRejectValue {
|
||||||
error?: unknown;
|
error?: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface AppMeta {
|
||||||
|
skipLoading?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export const createAppAsyncThunk = createAsyncThunk.withTypes<{
|
export const createAppAsyncThunk = createAsyncThunk.withTypes<{
|
||||||
state: RootState;
|
state: RootState;
|
||||||
dispatch: AppDispatch;
|
dispatch: AppDispatch;
|
||||||
rejectValue: AsyncThunkRejectValue;
|
rejectValue: AsyncThunkRejectValue;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
type AppThunkApi = Pick<
|
||||||
|
BaseThunkAPI<
|
||||||
|
RootState,
|
||||||
|
unknown,
|
||||||
|
AppDispatch,
|
||||||
|
AsyncThunkRejectValue,
|
||||||
|
AppMeta,
|
||||||
|
AppMeta
|
||||||
|
>,
|
||||||
|
'getState' | 'dispatch'
|
||||||
|
>;
|
||||||
|
|
||||||
|
interface AppThunkOptions {
|
||||||
|
skipLoading?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const createBaseAsyncThunk = createAsyncThunk.withTypes<{
|
||||||
|
state: RootState;
|
||||||
|
dispatch: AppDispatch;
|
||||||
|
rejectValue: AsyncThunkRejectValue;
|
||||||
|
fulfilledMeta: AppMeta;
|
||||||
|
rejectedMeta: AppMeta;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
export function createThunk<Arg = void, Returned = void>(
|
||||||
|
name: string,
|
||||||
|
creator: (arg: Arg, api: AppThunkApi) => Returned | Promise<Returned>,
|
||||||
|
options: AppThunkOptions = {},
|
||||||
|
) {
|
||||||
|
return createBaseAsyncThunk(
|
||||||
|
name,
|
||||||
|
async (
|
||||||
|
arg: Arg,
|
||||||
|
{ getState, dispatch, fulfillWithValue, rejectWithValue },
|
||||||
|
) => {
|
||||||
|
try {
|
||||||
|
const result = await creator(arg, { dispatch, getState });
|
||||||
|
|
||||||
|
return fulfillWithValue(result, {
|
||||||
|
skipLoading: options.skipLoading,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
return rejectWithValue({ error }, { skipLoading: true });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
getPendingMeta() {
|
||||||
|
if (options.skipLoading) return { skipLoading: true };
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const discardLoadDataInPayload = Symbol('discardLoadDataInPayload');
|
||||||
|
type DiscardLoadData = typeof discardLoadDataInPayload;
|
||||||
|
|
||||||
|
type OnData<LoadDataResult, ReturnedData> = (
|
||||||
|
data: LoadDataResult,
|
||||||
|
api: AppThunkApi & {
|
||||||
|
discardLoadData: DiscardLoadData;
|
||||||
|
},
|
||||||
|
) => ReturnedData | DiscardLoadData | Promise<ReturnedData | DiscardLoadData>;
|
||||||
|
|
||||||
|
type ArgsType = Record<string, unknown> | undefined;
|
||||||
|
|
||||||
|
// Overload when there is no `onData` method, the payload is the `onData` result
|
||||||
|
export function createDataLoadingThunk<LoadDataResult, Args extends ArgsType>(
|
||||||
|
name: string,
|
||||||
|
loadData: (args: Args) => Promise<LoadDataResult>,
|
||||||
|
thunkOptions?: AppThunkOptions,
|
||||||
|
): ReturnType<typeof createThunk<Args, LoadDataResult>>;
|
||||||
|
|
||||||
|
// Overload when the `onData` method returns discardLoadDataInPayload, then the payload is empty
|
||||||
|
export function createDataLoadingThunk<LoadDataResult, Args extends ArgsType>(
|
||||||
|
name: string,
|
||||||
|
loadData: (args: Args) => Promise<LoadDataResult>,
|
||||||
|
onDataOrThunkOptions?:
|
||||||
|
| AppThunkOptions
|
||||||
|
| OnData<LoadDataResult, DiscardLoadData>,
|
||||||
|
thunkOptions?: AppThunkOptions,
|
||||||
|
): ReturnType<typeof createThunk<Args, void>>;
|
||||||
|
|
||||||
|
// Overload when the `onData` method returns nothing, then the mayload is the `onData` result
|
||||||
|
export function createDataLoadingThunk<LoadDataResult, Args extends ArgsType>(
|
||||||
|
name: string,
|
||||||
|
loadData: (args: Args) => Promise<LoadDataResult>,
|
||||||
|
onDataOrThunkOptions?: AppThunkOptions | OnData<LoadDataResult, void>,
|
||||||
|
thunkOptions?: AppThunkOptions,
|
||||||
|
): ReturnType<typeof createThunk<Args, LoadDataResult>>;
|
||||||
|
|
||||||
|
// Overload when there is an `onData` method returning something
|
||||||
|
export function createDataLoadingThunk<
|
||||||
|
LoadDataResult,
|
||||||
|
Args extends ArgsType,
|
||||||
|
Returned,
|
||||||
|
>(
|
||||||
|
name: string,
|
||||||
|
loadData: (args: Args) => Promise<LoadDataResult>,
|
||||||
|
onDataOrThunkOptions?: AppThunkOptions | OnData<LoadDataResult, Returned>,
|
||||||
|
thunkOptions?: AppThunkOptions,
|
||||||
|
): ReturnType<typeof createThunk<Args, Returned>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function creates a Redux Thunk that handles loading data asynchronously (usually from the API), dispatching `pending`, `fullfilled` and `rejected` actions.
|
||||||
|
*
|
||||||
|
* You can run a callback on the `onData` results to either dispatch side effects or modify the payload.
|
||||||
|
*
|
||||||
|
* It is a wrapper around RTK's [`createAsyncThunk`](https://redux-toolkit.js.org/api/createAsyncThunk)
|
||||||
|
* @param name Prefix for the actions types
|
||||||
|
* @param loadData Function that loads the data. It's (object) argument will become the thunk's argument
|
||||||
|
* @param onDataOrThunkOptions
|
||||||
|
* Callback called on the results from `loadData`.
|
||||||
|
*
|
||||||
|
* First argument will be the return from `loadData`.
|
||||||
|
*
|
||||||
|
* Second argument is an object with: `dispatch`, `getState` and `discardLoadData`.
|
||||||
|
* It can return:
|
||||||
|
* - `undefined` (or no explicit return), meaning that the `onData` results will be the payload
|
||||||
|
* - `discardLoadData` to discard the `onData` results and return an empty payload
|
||||||
|
* - anything else, which will be the payload
|
||||||
|
*
|
||||||
|
* You can also omit this parameter and pass `thunkOptions` directly
|
||||||
|
* @param maybeThunkOptions
|
||||||
|
* Additional Mastodon specific options for the thunk. Currently supports:
|
||||||
|
* - `skipLoading` to avoid showing the loading bar when the request is in progress
|
||||||
|
* @returns The created thunk
|
||||||
|
*/
|
||||||
|
export function createDataLoadingThunk<
|
||||||
|
LoadDataResult,
|
||||||
|
Args extends ArgsType,
|
||||||
|
Returned,
|
||||||
|
>(
|
||||||
|
name: string,
|
||||||
|
loadData: (args: Args) => Promise<LoadDataResult>,
|
||||||
|
onDataOrThunkOptions?: AppThunkOptions | OnData<LoadDataResult, Returned>,
|
||||||
|
maybeThunkOptions?: AppThunkOptions,
|
||||||
|
) {
|
||||||
|
let onData: OnData<LoadDataResult, Returned> | undefined;
|
||||||
|
let thunkOptions: AppThunkOptions | undefined;
|
||||||
|
|
||||||
|
if (typeof onDataOrThunkOptions === 'function') onData = onDataOrThunkOptions;
|
||||||
|
else if (typeof onDataOrThunkOptions === 'object')
|
||||||
|
thunkOptions = onDataOrThunkOptions;
|
||||||
|
|
||||||
|
if (maybeThunkOptions) {
|
||||||
|
thunkOptions = maybeThunkOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
return createThunk<Args, Returned>(
|
||||||
|
name,
|
||||||
|
async (arg, { getState, dispatch }) => {
|
||||||
|
const data = await loadData(arg);
|
||||||
|
|
||||||
|
if (!onData) return data as Returned;
|
||||||
|
|
||||||
|
const result = await onData(data, {
|
||||||
|
dispatch,
|
||||||
|
getState,
|
||||||
|
discardLoadData: discardLoadDataInPayload,
|
||||||
|
});
|
||||||
|
|
||||||
|
// if there is no return in `onData`, we return the `onData` result
|
||||||
|
if (typeof result === 'undefined') return data as Returned;
|
||||||
|
// the user explicitely asked to discard the payload
|
||||||
|
else if (result === discardLoadDataInPayload)
|
||||||
|
return undefined as Returned;
|
||||||
|
else return result;
|
||||||
|
},
|
||||||
|
thunkOptions,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
import WebSocketClient from '@gamestdio/websocket';
|
import WebSocketClient from '@gamestdio/websocket';
|
||||||
|
|
||||||
|
import { getAccessToken } from './initial_state';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {WebSocketClient | undefined}
|
* @type {WebSocketClient | undefined}
|
||||||
*/
|
*/
|
||||||
|
@ -145,9 +147,11 @@ const channelNameWithInlineParams = (channelName, params) => {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
export const connectStream = (channelName, params, callbacks) => (dispatch, getState) => {
|
export const connectStream = (channelName, params, callbacks) => (dispatch, getState) => {
|
||||||
const streamingAPIBaseURL = getState().getIn(['meta', 'streaming_api_base_url']);
|
const streamingAPIBaseURL = getState().getIn(['meta', 'streaming_api_base_url']);
|
||||||
const accessToken = getState().getIn(['meta', 'access_token']);
|
const accessToken = getAccessToken();
|
||||||
const { onConnect, onReceive, onDisconnect } = callbacks(dispatch, getState);
|
const { onConnect, onReceive, onDisconnect } = callbacks(dispatch, getState);
|
||||||
|
|
||||||
|
if(!accessToken) throw new Error("Trying to connect to the streaming server but no access token is available.");
|
||||||
|
|
||||||
// If we cannot use a websockets connection, we must fall back
|
// If we cannot use a websockets connection, we must fall back
|
||||||
// to using individual connections for each channel
|
// to using individual connections for each channel
|
||||||
if (!streamingAPIBaseURL.startsWith('ws')) {
|
if (!streamingAPIBaseURL.startsWith('ws')) {
|
||||||
|
|
|
@ -14,7 +14,6 @@ function render(
|
||||||
const fakeIdentity = {
|
const fakeIdentity = {
|
||||||
signedIn: signedIn,
|
signedIn: signedIn,
|
||||||
accountId: '123',
|
accountId: '123',
|
||||||
accessToken: 'test-access-token',
|
|
||||||
disabledAccountId: undefined,
|
disabledAccountId: undefined,
|
||||||
permissions: 0,
|
permissions: 0,
|
||||||
};
|
};
|
||||||
|
|
|
@ -3896,6 +3896,10 @@ $ui-header-logo-wordmark-width: 99px;
|
||||||
border: 1px solid var(--background-border-color);
|
border: 1px solid var(--background-border-color);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
|
||||||
|
&.bottomless {
|
||||||
|
border-radius: 8px 8px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
&__actions {
|
&__actions {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
inset-inline-start: 0;
|
inset-inline-start: 0;
|
||||||
|
@ -4372,7 +4376,7 @@ a.status-card {
|
||||||
color: $primary-text-color;
|
color: $primary-text-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon-sliders {
|
||||||
transform: rotate(60deg);
|
transform: rotate(60deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4383,7 +4387,7 @@ a.status-card {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-reduce-motion .column-header__button .icon {
|
.no-reduce-motion .column-header__button .icon-sliders {
|
||||||
transition: transform 150ms ease-in-out;
|
transition: transform 150ms ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10223,3 +10227,42 @@ noscript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.more-from-author {
|
||||||
|
font-size: 14px;
|
||||||
|
color: $darker-text-color;
|
||||||
|
background: var(--surface-background-color);
|
||||||
|
border: 1px solid var(--background-border-color);
|
||||||
|
border-top: 0;
|
||||||
|
border-radius: 0 0 8px 8px;
|
||||||
|
padding: 15px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
height: 16px;
|
||||||
|
color: $darker-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > span {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: $primary-text-color;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus,
|
||||||
|
&:active {
|
||||||
|
color: $highlight-text-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
def process_status_params
|
def process_status_params
|
||||||
@status_parser = ActivityPub::Parser::StatusParser.new(@json, followers_collection: @account.followers_url, object: @object)
|
@status_parser = ActivityPub::Parser::StatusParser.new(@json, followers_collection: @account.followers_url, object: @object)
|
||||||
|
|
||||||
attachment_ids = process_attachments.take(4).map(&:id)
|
attachment_ids = process_attachments.take(Status::MEDIA_ATTACHMENTS_LIMIT).map(&:id)
|
||||||
|
|
||||||
@params = {
|
@params = {
|
||||||
uri: @status_parser.uri,
|
uri: @status_parser.uri,
|
||||||
|
@ -260,7 +260,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
as_array(@object['attachment']).each do |attachment|
|
as_array(@object['attachment']).each do |attachment|
|
||||||
media_attachment_parser = ActivityPub::Parser::MediaAttachmentParser.new(attachment)
|
media_attachment_parser = ActivityPub::Parser::MediaAttachmentParser.new(attachment)
|
||||||
|
|
||||||
next if media_attachment_parser.remote_url.blank? || media_attachments.size >= 4
|
next if media_attachment_parser.remote_url.blank? || media_attachments.size >= Status::MEDIA_ATTACHMENTS_LIMIT
|
||||||
|
|
||||||
begin
|
begin
|
||||||
media_attachment = MediaAttachment.create(
|
media_attachment = MediaAttachment.create(
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
class ActivityPub::Parser::StatusParser
|
class ActivityPub::Parser::StatusParser
|
||||||
include JsonLdHelper
|
include JsonLdHelper
|
||||||
|
|
||||||
|
NORMALIZED_LOCALE_NAMES = LanguagesHelper::SUPPORTED_LOCALES.keys.index_by(&:downcase).freeze
|
||||||
|
|
||||||
# @param [Hash] json
|
# @param [Hash] json
|
||||||
# @param [Hash] options
|
# @param [Hash] options
|
||||||
# @option options [String] :followers_collection
|
# @option options [String] :followers_collection
|
||||||
|
@ -87,6 +89,13 @@ class ActivityPub::Parser::StatusParser
|
||||||
end
|
end
|
||||||
|
|
||||||
def language
|
def language
|
||||||
|
lang = raw_language_code
|
||||||
|
lang.presence && NORMALIZED_LOCALE_NAMES.fetch(lang.downcase.to_sym, lang)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def raw_language_code
|
||||||
if content_language_map?
|
if content_language_map?
|
||||||
@object['contentMap'].keys.first
|
@object['contentMap'].keys.first
|
||||||
elsif name_language_map?
|
elsif name_language_map?
|
||||||
|
@ -96,8 +105,6 @@ class ActivityPub::Parser::StatusParser
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def audience_to
|
def audience_to
|
||||||
as_array(@object['to'] || @json['to']).map { |x| value_or_id(x) }
|
as_array(@object['to'] || @json['to']).map { |x| value_or_id(x) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,6 +33,6 @@ class ActivityPub::Serializer < ActiveModel::Serializer
|
||||||
adapter_options[:named_contexts].merge!(_named_contexts)
|
adapter_options[:named_contexts].merge!(_named_contexts)
|
||||||
adapter_options[:context_extensions].merge!(_context_extensions)
|
adapter_options[:context_extensions].merge!(_context_extensions)
|
||||||
end
|
end
|
||||||
super(adapter_options, options, adapter_instance)
|
super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ require_relative 'shared_timed_stack'
|
||||||
|
|
||||||
class ConnectionPool::SharedConnectionPool < ConnectionPool
|
class ConnectionPool::SharedConnectionPool < ConnectionPool
|
||||||
def initialize(options = {}, &block)
|
def initialize(options = {}, &block)
|
||||||
super(options, &block)
|
super
|
||||||
|
|
||||||
@available = ConnectionPool::SharedTimedStack.new(@size, &block)
|
@available = ConnectionPool::SharedTimedStack.new(@size, &block)
|
||||||
end
|
end
|
||||||
|
|
|
@ -195,6 +195,10 @@ class LinkDetailsExtractor
|
||||||
structured_data&.author_url
|
structured_data&.author_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def author_account
|
||||||
|
opengraph_tag('fediverse:creator')
|
||||||
|
end
|
||||||
|
|
||||||
def embed_url
|
def embed_url
|
||||||
valid_url_or_nil(opengraph_tag('twitter:player:stream'))
|
valid_url_or_nil(opengraph_tag('twitter:player:stream'))
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class RSS::Channel < RSS::Element
|
class RSS::Channel < RSS::Element
|
||||||
def initialize
|
def initialize
|
||||||
super()
|
super
|
||||||
|
|
||||||
@root = create_element('channel')
|
@root = create_element('channel')
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class RSS::Item < RSS::Element
|
class RSS::Item < RSS::Element
|
||||||
def initialize
|
def initialize
|
||||||
super()
|
super
|
||||||
|
|
||||||
@root = create_element('item')
|
@root = create_element('item')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Vacuum::ApplicationsVacuum
|
|
||||||
def perform
|
|
||||||
Doorkeeper::Application.where(owner_id: nil)
|
|
||||||
.where.missing(:created_users, :access_tokens, :access_grants)
|
|
||||||
.where(created_at: ...1.day.ago)
|
|
||||||
.in_batches.delete_all
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -142,6 +142,8 @@ class Account < ApplicationRecord
|
||||||
scope :not_excluded_by_account, ->(account) { where.not(id: account.excluded_from_timeline_account_ids) }
|
scope :not_excluded_by_account, ->(account) { where.not(id: account.excluded_from_timeline_account_ids) }
|
||||||
scope :not_domain_blocked_by_account, ->(account) { where(arel_table[:domain].eq(nil).or(arel_table[:domain].not_in(account.excluded_from_timeline_domains))) }
|
scope :not_domain_blocked_by_account, ->(account) { where(arel_table[:domain].eq(nil).or(arel_table[:domain].not_in(account.excluded_from_timeline_domains))) }
|
||||||
scope :dormant, -> { joins(:account_stat).merge(AccountStat.without_recent_activity) }
|
scope :dormant, -> { joins(:account_stat).merge(AccountStat.without_recent_activity) }
|
||||||
|
scope :with_username, ->(value) { where arel_table[:username].lower.eq(value.to_s.downcase) }
|
||||||
|
scope :with_domain, ->(value) { where arel_table[:domain].lower.eq(value&.to_s&.downcase) }
|
||||||
|
|
||||||
after_update_commit :trigger_update_webhooks
|
after_update_commit :trigger_update_webhooks
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue