Merge commit 'ce1680e6f979889ebd5c775353f3b82a8b2698bb' into glitch-soc/merge-upstream

Conflicts:
- `app/models/concerns/user/has_settings.rb`:
  Upstream added a new helper for a setting, where glitch-soc had extra ones.
  Not a real conflict, added upstream's new helper without removing glitch-soc's ones.
This commit is contained in:
Claire committed 2025-08-09 23:02:43 +02:00
commit 11902d958f
45 files changed
+890 -137

No files matched your search

@@ -228,6 +228,8 @@ export function submitCompose() {
visibility: getState().getIn(['compose', 'privacy']),
poll: getState().getIn(['compose', 'poll'], null),
language: getState().getIn(['compose', 'language']),
quoted_status_id: getState().getIn(['compose', 'quoted_status_id']),
quote_approval_policy: getState().getIn(['compose', 'quote_policy']),
},
headers: {
'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']),
@@ -1,9 +1,18 @@
import { createAction } from '@reduxjs/toolkit';
import type { List as ImmutableList, Map as ImmutableMap } from 'immutable';
import { apiUpdateMedia } from 'mastodon/api/compose';
import type { ApiMediaAttachmentJSON } from 'mastodon/api_types/media_attachments';
import type { MediaAttachment } from 'mastodon/models/media_attachment';
import { createDataLoadingThunk } from 'mastodon/store/typed_functions';
import {
createDataLoadingThunk,
createAppThunk,
} from 'mastodon/store/typed_functions';
import type { ApiQuotePolicy } from '../api_types/quotes';
import type { Status } from '../models/status';
import { ensureComposeIsVisible } from './compose';
type SimulatedMediaAttachmentJSON = ApiMediaAttachmentJSON & {
unattached?: boolean;
@@ -68,3 +77,26 @@ export const changeUploadCompose = createDataLoadingThunk(
useLoadingBar: false,
},
);
export const quoteComposeByStatus = createAppThunk(
'compose/quoteComposeStatus',
(status: Status, { getState }) => {
ensureComposeIsVisible(getState);
return status;
},
);
export const quoteComposeById = createAppThunk(
(statusId: string, { dispatch, getState }) => {
const status = getState().statuses.get(statusId);
if (status) {
dispatch(quoteComposeByStatus(status));
}
},
);
export const quoteComposeCancel = createAction('compose/quoteComposeCancel');
export const setQuotePolicy = createAction<ApiQuotePolicy>(
'compose/setQuotePolicy',
);
@@ -0,0 +1,23 @@
import type { ApiStatusJSON } from './statuses';
export type ApiQuoteState = 'accepted' | 'pending' | 'revoked' | 'unauthorized';
export type ApiQuotePolicy = 'public' | 'followers' | 'nobody';
interface ApiQuoteEmptyJSON {
state: Exclude<ApiQuoteState, 'accepted'>;
quoted_status: null;
}
interface ApiNestedQuoteJSON {
state: 'accepted';
quoted_status_id: string;
}
interface ApiQuoteAcceptedJSON {
state: 'accepted';
quoted_status: Omit<ApiStatusJSON, 'quote'> & {
quote: ApiNestedQuoteJSON | ApiQuoteEmptyJSON;
};
}
export type ApiQuoteJSON = ApiQuoteAcceptedJSON | ApiQuoteEmptyJSON;
@@ -4,6 +4,7 @@ import type { ApiAccountJSON } from './accounts';
import type { ApiCustomEmojiJSON } from './custom_emoji';
import type { ApiMediaAttachmentJSON } from './media_attachments';
import type { ApiPollJSON } from './polls';
import type { ApiQuoteJSON } from './quotes';
// See app/modals/status.rb
export type StatusVisibility =
@@ -118,6 +119,7 @@ export interface ApiStatusJSON {
card?: ApiPreviewCardJSON;
poll?: ApiPollJSON;
quote?: ApiQuoteJSON;
}
export interface ApiContextJSON {
+80 -7
View File
@@ -43,7 +43,7 @@
"account.followers": "Падпісчыкі",
"account.followers.empty": "Ніхто пакуль не падпісаны на гэтага карыстальніка.",
"account.followers_counter": "{count, plural, one {{counter} падпісчык} few {{counter} падпісчыкі} many {{counter} падпісчыкаў} other {{counter} падпісчыка}}",
"account.followers_you_know_counter": "{count, one {{counter}, знаёмы вам} other {{counter}, знаёмых вам}}",
"account.followers_you_know_counter": "{count, plural, one {{counter}, знаёмы вам} other {{counter}, знаёмых вам}}",
"account.following": "Падпіскі",
"account.following_counter": "{count, plural, one {{counter} падпіска} few {{counter} падпіскі} many {{counter} падпісак} other {{counter} падпіскі}}",
"account.follows.empty": "Карыстальнік ні на каго не падпісаны.",
@@ -62,6 +62,7 @@
"account.mute_notifications_short": "Не апавяшчаць",
"account.mute_short": "Ігнараваць",
"account.muted": "Ігнаруецца",
"account.muting": "Ігнараванне",
"account.mutual": "Вы падпісаны адно на аднаго",
"account.no_bio": "Апісанне адсутнічае.",
"account.open_original_page": "Адкрыць арыгінальную старонку",
@@ -103,6 +104,8 @@
"alt_text_modal.add_text_from_image": "Дадаць тэкст з відарыса",
"alt_text_modal.cancel": "Скасаваць",
"alt_text_modal.change_thumbnail": "Змяніць мініяцюру",
"alt_text_modal.describe_for_people_with_hearing_impairments": "Апішыце гэта людзям з праблемамі са слыхам…",
"alt_text_modal.describe_for_people_with_visual_impairments": "Апішыце гэта людзям з праблемамі са зрокам…",
"alt_text_modal.done": "Гатова",
"announcement.announcement": "Аб'ява",
"annual_report.summary.archetype.booster": "Паляўнічы на трэнды",
@@ -216,7 +219,13 @@
"confirmations.delete_list.confirm": "Выдаліць",
"confirmations.delete_list.message": "Вы ўпэўненыя, што хочаце беззваротна выдаліць гэты чарнавік?",
"confirmations.delete_list.title": "Выдаліць спіс?",
"confirmations.discard_draft.confirm": "Адмовіцца і працягнуць",
"confirmations.discard_draft.edit.cancel": "Працягнуць рэдагаванне",
"confirmations.discard_draft.edit.message": "Калі працягнуць, то ўсе змены, што Вы зрабілі ў гэтым допісе, будуць адмененыя.",
"confirmations.discard_draft.edit.title": "Адмовіцца ад змен у Вашым допісе?",
"confirmations.discard_draft.post.cancel": "Працягнуць чарнавік",
"confirmations.discard_draft.post.message": "Калі працягнуць, то допіс, які Вы зараз пішаце, не будзе апублікаваны.",
"confirmations.discard_draft.post.title": "Выдаліць чарнавік?",
"confirmations.discard_edit_media.confirm": "Адмяніць",
"confirmations.discard_edit_media.message": "У вас ёсць незахаваныя змены ў апісанні або прэв'ю, усе роўна скасаваць іх?",
"confirmations.follow_to_list.confirm": "Падпісацца і дадаць у спіс",
@@ -226,6 +235,7 @@
"confirmations.logout.message": "Вы ўпэўненыя, што хочаце выйсці?",
"confirmations.logout.title": "Выйсці?",
"confirmations.missing_alt_text.confirm": "Дадаць альтэрнатыўны тэкст",
"confirmations.missing_alt_text.message": "У Вашым допісе ёсць медыя без альтэрнатыўнага тэксту. Дадаванне апісання дапамагае зрабіць Ваш допіс даступным для большай колькасці людзей.",
"confirmations.missing_alt_text.secondary": "Усё адно апублікаваць",
"confirmations.missing_alt_text.title": "Дадаць альтэрнатыўны тэкст?",
"confirmations.mute.confirm": "Ігнараваць",
@@ -233,7 +243,11 @@
"confirmations.redraft.message": "Вы ўпэўнены, што хочаце выдаліць допіс і перапісаць яго? Упадабанні і пашырэнні згубяцца, а адказы да арыгінальнага допісу асірацеюць.",
"confirmations.redraft.title": "Выдаліць і перапісаць допіс?",
"confirmations.remove_from_followers.confirm": "Выдаліць падпісчыка",
"confirmations.remove_from_followers.message": "Карыстальнік {name} больш не будзе падпісаны на Вас. Упэўненыя, што хочаце працягнуць?",
"confirmations.remove_from_followers.title": "Выдаліць падпісчыка?",
"confirmations.revoke_quote.confirm": "Выдаліць допіс",
"confirmations.revoke_quote.message": "Гэтае дзеянне немагчыма адмяніць.",
"confirmations.revoke_quote.title": "Выдаліць допіс?",
"confirmations.unfollow.confirm": "Адпісацца",
"confirmations.unfollow.message": "Вы ўпэўненыя, што хочаце адпісацца ад {name}?",
"confirmations.unfollow.title": "Адпісацца ад карыстальніка?",
@@ -295,6 +309,9 @@
"emoji_button.search_results": "Вынікі пошуку",
"emoji_button.symbols": "Сімвалы",
"emoji_button.travel": "Падарожжы і месцы",
"empty_column.account_featured.me": "Вы яшчэ нічога не паказалі. Ці ведалі Вы, што ў сваім профілі Вы можаце паказаць свае хэштэгі, якім найбольш карыстаецеся, і нават профілі сваіх сяброў?",
"empty_column.account_featured.other": "{acct} яшчэ нічога не паказаў. Ці ведалі Вы, што ў сваім профілі Вы можаце паказаць свае хэштэгі, якім найбольш карыстаецеся, і нават профілі сваіх сяброў?",
"empty_column.account_featured_other.unknown": "Гэты профіль яшчэ нічога не паказаў.",
"empty_column.account_hides_collections": "Гэты карыстальнік вырашыў схаваць гэтую інфармацыю",
"empty_column.account_suspended": "Уліковы запіс прыпынены",
"empty_column.account_timeline": "Тут няма допісаў!",
@@ -327,6 +344,7 @@
"explore.trending_links": "Навіны",
"explore.trending_statuses": "Допісы",
"explore.trending_tags": "Хэштэгі",
"featured_carousel.header": "{count, plural,one {Замацаваны допіс} other {Замацаваныя допісы}}",
"featured_carousel.next": "Далей",
"featured_carousel.post": "Допіс",
"featured_carousel.previous": "Назад",
@@ -383,6 +401,8 @@
"generic.saved": "Захавана",
"getting_started.heading": "Пачатак працы",
"hashtag.admin_moderation": "Адкрыць інтэрфейс мадэратара для #{name}",
"hashtag.browse": "Праглядзець допісы ў #{hashtag}",
"hashtag.browse_from_account": "Праглядзець допісы ад @{name} у #{hashtag}",
"hashtag.column_header.tag_mode.all": "і {additional}",
"hashtag.column_header.tag_mode.any": "або {additional}",
"hashtag.column_header.tag_mode.none": "без {additional}",
@@ -395,7 +415,10 @@
"hashtag.counter_by_accounts": "{count, plural, one {{counter} удзельнік} few {{counter} удзельніка} many {{counter} удзельнікаў} other {{counter} удзельніка}}",
"hashtag.counter_by_uses": "{count, plural, one {{counter} допіс} few {{counter} допісы} many {{counter} допісаў} other {{counter} допісу}}",
"hashtag.counter_by_uses_today": "{count, plural, one {{counter} допіс} few {{counter} допісы} many {{counter} допісаў} other {{counter} допісу}} за сёння",
"hashtag.feature": "Паказваць у профілі",
"hashtag.follow": "Падпісацца на хэштэг",
"hashtag.mute": "Ігнараваць #{hashtag}",
"hashtag.unfeature": "Не паказваць у профілі",
"hashtag.unfollow": "Адпісацца ад хэштэга",
"hashtags.and_other": "…і яшчэ {count, plural, other {#}}",
"hints.profiles.followers_may_be_missing": "Падпісчыкі гэтага профілю могуць адсутнічаць.",
@@ -424,8 +447,12 @@
"ignore_notifications_modal.not_following_title": "Ігнараваць апавяшчэнні ад людзей на якіх вы не падпісаны?",
"ignore_notifications_modal.private_mentions_title": "Ігнараваць апавяшчэнні пра непажаданыя асабістыя згадванні?",
"info_button.label": "Даведка",
"info_button.what_is_alt_text": "<h1>Што такое альтэрнатыўны тэкст?</h1> <p>Альтэрнатыўны тэкст апісвае відарыс людзям з парушэннем зроку, павольным злучэннем або тым, каму патрэбны дадатковы кантэкст.</p> <p>Вы можаце зрабіць відарыс больш дасяжным і зразумелым для ўсіх, напісаўшы зразумелы, сціслы і аб'ектыўны альтэрнатыўны тэкст.</p> <ul><li>Ахоплівайце важныя элементы</li> <li>Тлумачце тэкст на відарысе</li> <li>Карыстайцеся звычайнымі сказамі</li> <li>Пазбягайце залішняй інфармацыі</li> <li>Засяроджвайцеся на тэндэнцыях і ключавых высновах у цяжкіх для разумення візуальных матэрыялах (напрыклад, дыяграмах або картах)</li></ul>",
"interaction_modal.action.favourite": "Каб працягнуць, вы мусіце ўпадабаць нешта са свайго ўліковага запісу.",
"interaction_modal.action.follow": "Каб працягнуць, вы мусіце падпісацца на некага са свайго ўліковага запісу.",
"interaction_modal.action.reblog": "Каб працягнуць, Вам трэба пашырыць допіс са свайго профілю.",
"interaction_modal.action.reply": "Каб працягнуць, Вам трэба адказаць са свайго профілю.",
"interaction_modal.action.vote": "Каб працягнуць, Вам трэба прагаласаваць са свайго профілю.",
"interaction_modal.go": "Перайсці",
"interaction_modal.no_account_yet": "Не маеце ўліковага запісу?",
"interaction_modal.on_another_server": "На іншым серверы",
@@ -434,6 +461,7 @@
"interaction_modal.title.follow": "Падпісацца на {name}",
"interaction_modal.title.reblog": "Пашырыць допіс ад {name}",
"interaction_modal.title.reply": "Адказаць на допіс {name}",
"interaction_modal.title.vote": "Прагаласуйце ў апытанні {name}",
"interaction_modal.username_prompt": "Напр., {example}",
"intervals.full.days": "{number, plural, one {# дзень} few {# дні} many {# дзён} other {# дня}}",
"intervals.full.hours": "{number, plural, one {# гадзіна} few {# гадзіны} many {# гадзін} other {# гадзіны}}",
@@ -473,6 +501,8 @@
"keyboard_shortcuts.translate": "каб перакласці допіс",
"keyboard_shortcuts.unfocus": "Расфакусаваць тэкставую вобласць/пошукавы радок",
"keyboard_shortcuts.up": "Перамясціцца ўверх па спісе",
"learn_more_link.got_it": "Зразумеў(-ла)",
"learn_more_link.learn_more": "Падрабязней",
"lightbox.close": "Закрыць",
"lightbox.next": "Далей",
"lightbox.previous": "Назад",
@@ -487,10 +517,15 @@
"lists.add_to_list": "Дадаць у спіс",
"lists.add_to_lists": "Дадаць {name} у спісы",
"lists.create": "Стварыць",
"lists.create_a_list_to_organize": "Стварыце новы спіс, каб арганізаваць сваю Галоўную старонку",
"lists.create_list": "Стварыць спіс",
"lists.delete": "Выдаліць спіс",
"lists.done": "Гатова",
"lists.edit": "Рэдагаваць спіс",
"lists.exclusive": "Схаваць карыстальнікаў на Галоўнай старонцы",
"lists.exclusive_hint": "Калі ў гэтым спісе нехта ёсць, схавайце яго на сваёй Галоўнай старонцы, каб не бачыць яго допісы двойчы.",
"lists.find_users_to_add": "Знайсці карыстальнікаў, каб дадаць",
"lists.list_members_count": "{count, plural,one {# карыстальнік}other {# карыстальнікі}}",
"lists.list_name": "Назва спіса",
"lists.new_list_name": "Назва новага спіса",
"lists.no_lists_yet": "Пакуль няма спісаў.",
@@ -502,6 +537,7 @@
"lists.replies_policy.none": "Нікога",
"lists.save": "Захаваць",
"lists.search": "Пошук",
"lists.show_replies_to": "Уключыць адказы ад карыстальнікаў са спіса",
"load_pending": "{count, plural, one {# новы элемент} few {# новыя элементы} many {# новых элементаў} other {# новых элементаў}}",
"loading_indicator.label": "Ідзе загрузка…",
"media_gallery.hide": "Схаваць",
@@ -544,6 +580,8 @@
"navigation_bar.search_trends": "Пошук / Трэндавае",
"navigation_panel.collapse_followed_tags": "Згарнуць меню падпісак на хэштэгі",
"navigation_panel.collapse_lists": "Згарнуць меню спісаў",
"navigation_panel.expand_followed_tags": "Разгарнуць меню падпісак на хэштэгі",
"navigation_panel.expand_lists": "Разгарнуць меню спіса",
"not_signed_in_indicator.not_signed_in": "Вам трэба ўвайсці каб атрымаць доступ да гэтага рэсурсу.",
"notification.admin.report": "{name} паскардзіўся на {target}",
"notification.admin.report_account": "{name} паскардзіўся на {count, plural, one {# допіс} many {# допісаў} other {# допіса}} ад {target} з прычыны {category}",
@@ -551,16 +589,21 @@
"notification.admin.report_statuses": "{name} паскардзіўся на {target} з прычыны {category}",
"notification.admin.report_statuses_other": "{name} паскардзіўся на {target}",
"notification.admin.sign_up": "{name} зарэгістраваўся",
"notification.admin.sign_up.name_and_others": "{name} і {count, plural, one {# іншы} other {# іншых}} зарэгістраваліся",
"notification.annual_report.message": "Вас чакае Ваш #Wrapstodon нумар {year}! Падзяліцеся сваімі галоўнымі падзеямі і запамінальнымі момантамі ў Mastodon!",
"notification.annual_report.view": "Перайсці да #Wrapstodon",
"notification.favourite": "Ваш допіс упадабаны {name}",
"notification.favourite": "Карыстальнік {name} упадабаў Ваш допіс",
"notification.favourite.name_and_others_with_link": "{name} і <a>{count, plural, one {# іншы} other {# іншыя}}</a> ўпадабалі Ваш допіс",
"notification.favourite_pm": "Ваша асабістае згадванне ўпадабана {name}",
"notification.favourite_pm.name_and_others_with_link": "{name} і <a>{count, plural, one {# іншы} few {# іншыя} many {# іншых} other {# іншых}}</a> ўпадабалі ваша асабістае згадванне",
"notification.follow": "{name} падпісаўся на вас",
"notification.follow.name_and_others": "{name} і <a>{count, plural, one {# іншы} other {# іншыя}}</a> падпісаліся на Вас",
"notification.follow_request": "{name} адправіў запыт на падпіску",
"notification.follow_request.name_and_others": "{name} і {count, plural, one {# іншы} many {# іншых} other {# іншых}} запыталіся падпісацца на вас",
"notification.label.mention": "Згадванне",
"notification.label.private_mention": "Асабістае згадванне",
"notification.label.private_reply": "Асабісты адказ",
"notification.label.quote": "Карыстальнік {name} цытаваў Ваш допіс",
"notification.label.reply": "Адказ",
"notification.mention": "Згадванне",
"notification.mentioned_you": "{name} згадаў вас",
@@ -576,7 +619,7 @@
"notification.own_poll": "Ваша апытанне скончылася",
"notification.poll": "Апытанне, дзе вы прынялі ўдзел, скончылася",
"notification.reblog": "{name} пашырыў ваш допіс",
"notification.reblog.name_and_others_with_link": "{name} і <a>{count, plural, one {# іншы} many {# іншых} other {# іншых}}</a> абагулілі ваш допіс",
"notification.reblog.name_and_others_with_link": "{name} і <a>{count, plural, one {# іншы} many {# іншых} other {# іншых}}</a> пашырылі ваш допіс",
"notification.relationships_severance_event": "Страціў сувязь з {name}",
"notification.relationships_severance_event.account_suspension": "Адміністратар з {from} прыпыніў працу {target}, што азначае, што вы больш не можаце атрымліваць ад іх абнаўлення ці ўзаемадзейнічаць з імі.",
"notification.relationships_severance_event.domain_block": "Адміністратар з {from} заблакіраваў {target}, у тым ліку {followersCount} вашых падпісчыка(-аў) і {followingCount, plural, one {# уліковы запіс} few {# уліковыя запісы} many {# уліковых запісаў} other {# уліковых запісаў}}.",
@@ -585,11 +628,19 @@
"notification.status": "Новы допіс ад {name}",
"notification.update": "Допіс {name} адрэдагаваны",
"notification_requests.accept": "Прыняць",
"notification_requests.accept_multiple": "{count, plural,one {Прыняць # запыт…} other {Прыняць # запытаў…}}",
"notification_requests.confirm_accept_multiple.button": "{count, plural,one {Прыняць запыт} other {Прыняць запыты}}",
"notification_requests.confirm_accept_multiple.message": "Вы збіраецеся прыняць {count, plural, one {адзін запыт на апавяшчэнне} other {# запытаў на апавяшчэнне}}. Упэўненыя, што хочаце працягнуць?",
"notification_requests.confirm_accept_multiple.title": "Прыняць запыты на апавяшчэнні?",
"notification_requests.confirm_dismiss_multiple.button": "{count, plural,one {Адмовіцца ад запыту} other {Адмовіцца ад запытаў}}",
"notification_requests.confirm_dismiss_multiple.message": "Вы збіраецеся адмовіцца ад {count, plural, one {аднаго запыту на апавяшчэнне} other {# запытаў на апавяшчэнне}}. Вы не зможаце зноў лёгка атрымаць доступ да {count, plural, one {яго} other {іх}}. Упэўненыя, што хочаце працягнуць?",
"notification_requests.confirm_dismiss_multiple.title": "Адхіліць запыты на апавяшчэнні?",
"notification_requests.dismiss": "Адхіліць",
"notification_requests.dismiss_multiple": "{count, plural,one {Адмовіцца ад запыту…} other {Адмовіцца ад запытаў…}}",
"notification_requests.edit_selection": "Рэдагаваць",
"notification_requests.exit_selection": "Гатова",
"notification_requests.explainer_for_limited_account": "Апавяшчэнне з гэтага профілю было адфільтраванае, бо гэты профіль абмежаваў мадэратар.",
"notification_requests.explainer_for_limited_remote_account": "Апавяшчэнні з гэтага профілю былі адфільтраваныя, бо гэты профіль абмежаваў мадэратар.",
"notification_requests.maximize": "Разгарнуць",
"notification_requests.minimize_banner": "Згарнуць банер адфільтраваных апавяшчэнняў",
"notification_requests.notifications_from": "Апавяшчэнні ад {name}",
@@ -610,6 +661,7 @@
"notifications.column_settings.mention": "Згадванні:",
"notifications.column_settings.poll": "Вынікі апытання:",
"notifications.column_settings.push": "Push-апавяшчэнні",
"notifications.column_settings.quote": "Цытаваныя допісы:",
"notifications.column_settings.reblog": "Пашырэнні:",
"notifications.column_settings.show": "Паказваць у слупку",
"notifications.column_settings.sound": "Прайграваць гук",
@@ -633,7 +685,10 @@
"notifications.policy.accept": "Прыняць",
"notifications.policy.accept_hint": "Паказваць у апавяшчэннях",
"notifications.policy.drop": "Iгнараваць",
"notifications.policy.drop_hint": "Адправіць у бездань, адкуль больш ніколі не ўбачыце",
"notifications.policy.filter": "Фільтраваць",
"notifications.policy.filter_hint": "Адправіць у скрыню адфільтраваных апавяшчэнняў",
"notifications.policy.filter_limited_accounts_hint": "Абмежавана мадэратарамі сервера",
"notifications.policy.filter_limited_accounts_title": "Уліковыя запісы пад мадэрацыяй",
"notifications.policy.filter_new_accounts.hint": "Створаныя на працягу {days, plural, one {апошняга # дня} few {апошніх # дзён} many {апошніх # дзён} other {апошняй # дня}}",
"notifications.policy.filter_new_accounts_title": "Новыя ўліковыя запісы",
@@ -755,6 +810,7 @@
"report_notification.categories.violation": "Парушэнне правілаў",
"report_notification.categories.violation_sentence": "парушэнне правілаў",
"report_notification.open": "Адкрыць скаргу",
"search.clear": "Ачысціць пошук",
"search.no_recent_searches": "Гісторыя пошуку пустая",
"search.placeholder": "Пошук",
"search.quick_action.account_search": "Супадзенне профіляў {x}",
@@ -796,6 +852,8 @@
"status.bookmark": "Дадаць закладку",
"status.cancel_reblog_private": "Прыбраць",
"status.cannot_reblog": "Гэты пост нельга пашырыць",
"status.context.load_new_replies": "Даступныя новыя адказы",
"status.context.loading": "Правяраюцца новыя адказы",
"status.continued_thread": "Працяг ланцужка",
"status.copy": "Скапіраваць спасылку на допіс",
"status.delete": "Выдаліць",
@@ -807,7 +865,7 @@
"status.edited_x_times": "Рэдагавана {count, plural, one {{count} раз} few {{count} разы} many {{count} разоў} other {{count} разу}}",
"status.embed": "Атрымаць убудаваны код",
"status.favourite": "Упадабанае",
"status.favourites": "{count, plural, one {# упадабанае} few {# упадабаныя} many {# упадабаных} other {# упадабанага}}",
"status.favourites": "{count, plural, one {упадабанне} few {упадабанні} other {упадабанняў}}",
"status.filter": "Фільтраваць гэты допіс",
"status.history.created": "Створана {name} {date}",
"status.history.edited": "Адрэдагавана {name} {date}",
@@ -821,19 +879,27 @@
"status.mute_conversation": "Ігнараваць размову",
"status.open": "Разгарнуць гэты допіс",
"status.pin": "Замацаваць у профілі",
"status.quote_error.filtered": "Схавана адным з Вашых фільтраў",
"status.quote_error.not_available": "Допіс недаступны",
"status.quote_error.pending_approval": "Допіс чакае пацвярджэння",
"status.quote_error.pending_approval_popout.body": "Допісы, якія былі цытаваныя паміж серверамі Fediverse, могуць доўга загружацца, паколькі розныя серверы маюць розныя пратаколы.",
"status.quote_error.pending_approval_popout.title": "Цытаваны допіс чакае пацвярджэння? Захоўвайце спакой",
"status.quote_post_author": "Цытаваў допіс @{name}",
"status.read_more": "Чытаць болей",
"status.reblog": "Пашырыць",
"status.reblog_private": "Пашырыць з першапачатковай бачнасцю",
"status.reblogged_by": "{name} пашырыў(-ла)",
"status.reblogs": "{count, plural, one {# пашырэнне} few {# пашырэнні} many {# пашырэнняў} other {# пашырэння}}",
"status.reblogged_by": "Карыстальнік {name} пашырыў",
"status.reblogs": "{count, plural, one {пашырэнне} few {пашырэнні} many {пашырэнняў} other {пашырэння}}",
"status.reblogs.empty": "Гэты допіс яшчэ ніхто не пашырыў. Калі гэта адбудзецца, гэтых людзей будзе бачна тут.",
"status.redraft": "Выдаліць і паправіць",
"status.redraft": "Выдаліць і перапісаць",
"status.remove_bookmark": "Выдаліць закладку",
"status.remove_favourite": "Выдаліць з упадабаных",
"status.replied_in_thread": "Адказаў у ланцужку",
"status.replied_to": "Адказаў {name}",
"status.reply": "Адказаць",
"status.replyAll": "Адказаць у ланцугу",
"status.report": "Паскардзіцца на @{name}",
"status.revoke_quote": "Выдаліць мой допіс з допісу @{name}",
"status.sensitive_warning": "Уражвальны змест",
"status.share": "Абагуліць",
"status.show_less_all": "Згарнуць усё",
@@ -853,7 +919,9 @@
"tabs_bar.notifications": "Апавяшчэнні",
"tabs_bar.publish": "Новы допіс",
"tabs_bar.search": "Пошук",
"terms_of_service.effective_as_of": "Дзейнічае да {date}",
"terms_of_service.title": "Умовы выкарыстання",
"terms_of_service.upcoming_changes_on": "Змены, якія адбудуцца {date}",
"time_remaining.days": "{number, plural, one {застаўся # дзень} few {засталося # дні} many {засталося # дзён} other {засталося # дня}}",
"time_remaining.hours": "{number, plural, one {засталася # гадзіна} few {засталося # гадзіны} many {засталося # гадзін} other {засталося # гадзіны}}",
"time_remaining.minutes": "{number, plural, one {засталася # хвіліна} few {засталося # хвіліны} many {засталося # хвілін} other {засталося # хвіліны}}",
@@ -869,6 +937,11 @@
"upload_button.label": "Дадаць выяву, відэа- ці аўдыяфайл",
"upload_error.limit": "Перавышана колькасць файлаў.",
"upload_error.poll": "Немагчыма прымацаваць файл да апытання.",
"upload_form.drag_and_drop.instructions": "Каб абраць медыя далучэнне, націсніце прабел ці Enter. Падчас перасоўвання выкарыстоўвайце кнопкі са стрэлкамі, каб пасунуць медыя далучэнне ў любым напрамку. Націсніце прабел ці Enter зноў, каб перасунуць медыя далучэнне ў новае месца, або Escape для адмены.",
"upload_form.drag_and_drop.on_drag_cancel": "Перасоўванне адмененае. Медыя ўлажэнне {item} на месцы.",
"upload_form.drag_and_drop.on_drag_end": "Медыя ўлажэнне {item} на месцы.",
"upload_form.drag_and_drop.on_drag_over": "Медыя ўлажэнне {item} перасунутае.",
"upload_form.drag_and_drop.on_drag_start": "Абранае медыя ўлажэнне {item}.",
"upload_form.edit": "Рэдагаваць",
"upload_progress.label": "Запампоўванне...",
"upload_progress.processing": "Апрацоўка…",
+1 -1
View File
@@ -899,7 +899,7 @@
"status.reply": "Besvar",
"status.replyAll": "Svar alle",
"status.report": "Anmeld @{name}",
"status.revoke_quote": "Fjern mit indlæg fra @{name}'s indlæg",
"status.revoke_quote": "Fjern eget indlæg fra @{name}s indlæg",
"status.sensitive_warning": "Følsomt indhold",
"status.share": "Del",
"status.show_less_all": "Vis mindre for alle",
+4
View File
@@ -245,6 +245,9 @@
"confirmations.remove_from_followers.confirm": "Αφαίρεση ακολούθου",
"confirmations.remove_from_followers.message": "Ο χρήστης {name} θα σταματήσει να σε ακολουθεί. Σίγουρα θες να συνεχίσεις;",
"confirmations.remove_from_followers.title": "Αφαίρεση ακολούθου;",
"confirmations.revoke_quote.confirm": "Αφαίρεση ανάρτησης",
"confirmations.revoke_quote.message": "Αυτή η ενέργεια δεν μπορεί να αναιρεθεί.",
"confirmations.revoke_quote.title": "Αφαίρεση ανάρτησης;",
"confirmations.unfollow.confirm": "Άρση ακολούθησης",
"confirmations.unfollow.message": "Σίγουρα θες να πάψεις να ακολουθείς τον/την {name};",
"confirmations.unfollow.title": "Άρση ακολούθησης;",
@@ -896,6 +899,7 @@
"status.reply": "Απάντησε",
"status.replyAll": "Απάντησε στο νήμα συζήτησης",
"status.report": "Αναφορά @{name}",
"status.revoke_quote": "Αφαίρεση της ανάρτησης μου από την ανάρτηση του/της @{name}",
"status.sensitive_warning": "Ευαίσθητο περιεχόμενο",
"status.share": "Κοινοποίηση",
"status.show_less_all": "Δείξε λιγότερο για όλες",
+4
View File
@@ -245,6 +245,9 @@
"confirmations.remove_from_followers.confirm": "Poista seuraaja",
"confirmations.remove_from_followers.message": "{name} lakkaa seuraamasta sinua. Haluatko varmasti jatkaa?",
"confirmations.remove_from_followers.title": "Poistetaanko seuraaja?",
"confirmations.revoke_quote.confirm": "Poista julkaisu",
"confirmations.revoke_quote.message": "Tätä toimea ei voi peruuttaa.",
"confirmations.revoke_quote.title": "Poistetaanko julkaisu?",
"confirmations.unfollow.confirm": "Lopeta seuraaminen",
"confirmations.unfollow.message": "Haluatko varmasti lopettaa profiilin {name} seuraamisen?",
"confirmations.unfollow.title": "Lopetetaanko käyttäjän seuraaminen?",
@@ -896,6 +899,7 @@
"status.reply": "Vastaa",
"status.replyAll": "Vastaa ketjuun",
"status.report": "Raportoi @{name}",
"status.revoke_quote": "Poista julkaisuni käyttäjän @{name} julkaisusta",
"status.sensitive_warning": "Arkaluonteista sisältöä",
"status.share": "Jaa",
"status.show_less_all": "Näytä kaikista vähemmän",
+4
View File
@@ -245,6 +245,9 @@
"confirmations.remove_from_followers.confirm": "Bain leantóir",
"confirmations.remove_from_followers.message": "Scoirfidh {name} de bheith ag leanúint leat. An bhfuil tú cinnte gur mian leat leanúint ar aghaidh?",
"confirmations.remove_from_followers.title": "Bain an leantóir?",
"confirmations.revoke_quote.confirm": "Bain postáil",
"confirmations.revoke_quote.message": "Ní féidir an gníomh seo a chealú.",
"confirmations.revoke_quote.title": "Bain postáil?",
"confirmations.unfollow.confirm": "Ná lean",
"confirmations.unfollow.message": "An bhfuil tú cinnte gur mhaith leat {name} a dhíleanúint?",
"confirmations.unfollow.title": "Dílean ​​an t-úsáideoir?",
@@ -896,6 +899,7 @@
"status.reply": "Freagair",
"status.replyAll": "Freagair le snáithe",
"status.report": "Tuairiscigh @{name}",
"status.revoke_quote": "Bain mo phost ó phost @{name}",
"status.sensitive_warning": "Ábhar íogair",
"status.share": "Comhroinn",
"status.show_less_all": "Taispeáin níos lú d'uile",
+4
View File
@@ -245,6 +245,9 @@
"confirmations.remove_from_followers.confirm": "Követő eltávolítása",
"confirmations.remove_from_followers.message": "{name} követ téged. Biztos, hogy folytatod?",
"confirmations.remove_from_followers.title": "Követő eltávolítása?",
"confirmations.revoke_quote.confirm": "Bejegyzés eltávolítása",
"confirmations.revoke_quote.message": "Ez a művelet nem vonható vissza.",
"confirmations.revoke_quote.title": "Bejegyzés eltávolítása?",
"confirmations.unfollow.confirm": "Követés visszavonása",
"confirmations.unfollow.message": "Biztos, hogy vissza szeretnéd vonni {name} követését?",
"confirmations.unfollow.title": "Megszünteted a felhasználó követését?",
@@ -896,6 +899,7 @@
"status.reply": "Válasz",
"status.replyAll": "Válasz a beszélgetésre",
"status.report": "@{name} bejelentése",
"status.revoke_quote": "Saját bejegyzés eltávolítása @{name} bejegyzéséből",
"status.sensitive_warning": "Kényes tartalom",
"status.share": "Megosztás",
"status.show_less_all": "Kevesebbet mindenhol",
+19 -1
View File
@@ -85,9 +85,11 @@
"alt_text_modal.cancel": "Semmet",
"alt_text_modal.done": "Immed",
"announcement.announcement": "Ulɣu",
"annual_report.summary.followers.followers": "imeḍfaṛen",
"annual_report.summary.most_used_app.most_used_app": "asnas yettwasqedcen s waṭas",
"annual_report.summary.most_used_hashtag.none": "Ula yiwen",
"annual_report.summary.new_posts.new_posts": "tisuffaɣ timaynutin",
"annual_report.summary.percentile.we_wont_tell_bernie": "Ur as-neqqar i yiwen.",
"annual_report.summary.thanks": "Tanemmirt imi i tettekkiḍ deg Mastodon!",
"audio.hide": "Ffer amesli",
"block_modal.show_less": "Ssken-d drus",
@@ -123,6 +125,7 @@
"column.firehose": "Isuddam usriden",
"column.follow_requests": "Isuturen n teḍfeṛt",
"column.home": "Agejdan",
"column.list_members": "Sefrek iεeggalen n tebdart",
"column.lists": "Tibdarin",
"column.mutes": "Imiḍanen yettwasgugmen",
"column.notifications": "Ilɣa",
@@ -160,6 +163,7 @@
"compose_form.save_changes": "Leqqem",
"compose_form.spoiler.marked": "Kkes aḍris yettwaffren deffir n walɣu",
"compose_form.spoiler.unmarked": "Rnu aḍris yettwaffren deffir n walɣu",
"compose_form.spoiler_placeholder": "Alɣu n ugbur (afrayan)",
"confirmation_modal.cancel": "Sefsex",
"confirmations.block.confirm": "Sewḥel",
"confirmations.delete.confirm": "Kkes",
@@ -168,8 +172,10 @@
"confirmations.delete_list.confirm": "Kkes",
"confirmations.delete_list.message": "Tebɣiḍ s tidet ad tekkseḍ umuɣ-agi i lebda?",
"confirmations.delete_list.title": "Tukksa n tebdart?",
"confirmations.discard_draft.confirm": "Ttu-t u kemmel",
"confirmations.discard_edit_media.confirm": "Sefsex",
"confirmations.follow_to_list.confirm": "Ḍfeṛ-it sakin rnu-t ɣer tebdart",
"confirmations.follow_to_list.title": "Ḍfer aseqdac?",
"confirmations.logout.confirm": "Ffeɣ",
"confirmations.logout.message": "D tidet tebɣiḍ ad teffɣeḍ?",
"confirmations.logout.title": "Tebɣiḍ ad teffɣeḍ ssya?",
@@ -178,6 +184,8 @@
"confirmations.missing_alt_text.title": "Rnu aḍris amlellay?",
"confirmations.mute.confirm": "Sgugem",
"confirmations.redraft.confirm": "Kkes sakin ɛiwed tira",
"confirmations.remove_from_followers.confirm": "Kkes aneḍfar",
"confirmations.revoke_quote.confirm": "Kkes tasuffeɣt",
"confirmations.unfollow.confirm": "Ur ḍḍafaṛ ara",
"confirmations.unfollow.message": "Tetḥeqqeḍ belli tebɣiḍ ur teṭafaṛeḍ ara {name}?",
"content_warning.hide": "Ffer tasuffeɣt",
@@ -203,7 +211,12 @@
"domain_block_modal.you_wont_see_posts": "Ur tettuɣaleḍ ara ttwaliḍ tisuffaɣ neɣ ulɣuten n iseqdacen n uqeddac-a.",
"domain_pill.activitypub_like_language": "ActivityPub am tutlayt yettmeslay Mastodon d izeḍwan inmettiyen nniḍen.",
"domain_pill.server": "Aqeddac",
"domain_pill.their_handle": "Asulay-is:",
"domain_pill.username": "Isem n useqdac",
"domain_pill.whats_in_a_handle": "D acu i yellan deg usulay?",
"domain_pill.who_they_are": "Imi isulayen qqaren-d anwa i d yiwen d wanda yella, tzemreḍ ad temyigweḍ d yemdanen deg web anmetti yebnan s <button>tɣeṛɣaṛ yemmugen s ActivityPub</button>.",
"domain_pill.who_you_are": "Imi isulay-ik·im yeqqar-d anwa i d kečč·kemmi d wanda i telliḍ, zemren medden ad myigwen yid-k·m deg web anmetti yebnan s <button>tɣeṛɣaṛ yemmugen s ActivityPub</button>.",
"domain_pill.your_handle": "Asulay-ik·im:",
"domain_pill.your_server": "D axxam-inek·inem umḍin, anda i zedɣent akk tsuffaɣ-ik·im. Ur k·m-yeεǧib ara wa? Ssenfel-d iqeddacen melmi i ak·m-yehwa, awi-d daɣen ineḍfaren-ik·im yid-k·m.",
"embed.instructions": "Ẓẓu addad-agi deg usmel-inek·inem s wenɣal n tangalt yellan sdaw-agi.",
"embed.preview": "Akka ara d-iban:",
@@ -264,6 +277,7 @@
"firehose.remote": "Iqeddacen nniḍen",
"follow_request.authorize": "Ssireg",
"follow_request.reject": "Agi",
"follow_suggestions.curated_suggestion": "Yettwafren sɣur tarbaɛt",
"follow_suggestions.dismiss": "Dayen ur t-id-skan ara",
"follow_suggestions.featured_longer": "Yettwafraned s ufus sɣur agraw n {domain}",
"follow_suggestions.friends_of_friends_longer": "D aɣeṛfan ar wid i teṭṭafareḍ",
@@ -301,6 +315,7 @@
"hashtag.follow": "Ḍfeṛ ahacṭag",
"hashtag.mute": "Sgugem #{hashtag}",
"hashtags.and_other": "…d {count, plural, one {}other {# nniḍen}}",
"home.column_settings.show_quotes": "Sken-d tibdarin",
"home.column_settings.show_reblogs": "Ssken-d beṭṭu",
"home.column_settings.show_replies": "Ssken-d tiririyin",
"home.hide_announcements": "Ffer ulɣuyen",
@@ -354,6 +369,7 @@
"keyboard_shortcuts.toggle_hidden": "i uskan/tuffra n uḍris deffir CW",
"keyboard_shortcuts.toggle_sensitivity": "i teskent/tuffra n yimidyaten",
"keyboard_shortcuts.toot": "i wakken attebdud tajewwaqt tamaynut",
"keyboard_shortcuts.translate": "i usuqel n tsuffeɣt",
"keyboard_shortcuts.unfocus": "to un-focus compose textarea/search",
"keyboard_shortcuts.up": "i tulin ɣer d asawen n tebdart",
"learn_more_link.got_it": "Gziɣ-t",
@@ -458,6 +474,7 @@
"notifications.column_settings.mention": "Abdar:",
"notifications.column_settings.poll": "Igemmaḍ n usenqed:",
"notifications.column_settings.push": "Ilɣa yettudemmren",
"notifications.column_settings.quote": "Yebder-d:",
"notifications.column_settings.reblog": "Seǧhed:",
"notifications.column_settings.show": "Ssken-d tilɣa deg ujgu",
"notifications.column_settings.sound": "Rmed imesli",
@@ -631,6 +648,7 @@
"status.mute_conversation": "Sgugem adiwenni",
"status.open": "Semɣeṛ tasuffeɣt-ayi",
"status.pin": "Senteḍ-itt deg umaɣnu",
"status.quote_post_author": "Yebder-d tasuffeɣt sɣur @{name}",
"status.read_more": "Issin ugar",
"status.reblog": "Bḍu",
"status.reblogged_by": "Yebḍa-tt {name}",
@@ -650,7 +668,7 @@
"status.show_original": "Sken aɣbalu",
"status.title.with_attachments": "{user} posted {attachmentCount, plural, one {an attachment} other {# attachments}}",
"status.translate": "Suqel",
"status.translated_from_with": "Yettwasuqel seg {lang} s {provider}",
"status.translated_from_with": "Tettwasuqel seg {lang} s {provider}",
"status.uncached_media_warning": "Ulac taskant",
"status.unmute_conversation": "Kkes asgugem n udiwenni",
"status.unpin": "Kkes asenteḍ seg umaɣnu",
+4
View File
@@ -245,6 +245,9 @@
"confirmations.remove_from_followers.confirm": "팔로워 제거",
"confirmations.remove_from_followers.message": "{name} 님이 나를 팔로우하지 않게 됩니다. 계속할까요?",
"confirmations.remove_from_followers.title": "팔로워를 제거할까요?",
"confirmations.revoke_quote.confirm": "게시물 삭제",
"confirmations.revoke_quote.message": "이 작업은 되돌릴 수 없습니다.",
"confirmations.revoke_quote.title": "게시물을 지울까요?",
"confirmations.unfollow.confirm": "팔로우 해제",
"confirmations.unfollow.message": "정말로 {name} 님을 팔로우 해제하시겠습니까?",
"confirmations.unfollow.title": "사용자를 언팔로우 할까요?",
@@ -885,6 +888,7 @@
"status.reply": "답장",
"status.replyAll": "글타래에 답장",
"status.report": "@{name} 신고하기",
"status.revoke_quote": "내 게시물을 @{name}의 게시물에서 삭제",
"status.sensitive_warning": "민감한 내용",
"status.share": "공유",
"status.show_less_all": "모두 접기",
+1
View File
@@ -1,6 +1,7 @@
{
"about.blocks": "මැදිහත්කරණ සේවාදායක",
"about.contact": "සබඳතාව:",
"about.default_locale": "Default",
"about.disclaimer": "මාස්ටඩන් යනු නිදහස් විවෘත මූලාශ්‍ර මෘදුකාංගයකි. එය මාස්ටඩන් gGmbH හි වෙළඳ නාමයකි.",
"about.domain_blocks.no_reason_available": "හේතුව ලබා ගත නොහැක.",
"about.domain_blocks.preamble": "Mastodon සාමාන්‍යයෙන් ඔබට fediverse හි වෙනත් ඕනෑම සේවාදායකයකින් අන්තර්ගතයන් බැලීමට සහ පරිශීලකයින් සමඟ අන්තර් ක්‍රියා කිරීමට ඉඩ සලසයි. මෙම විශේෂිත සේවාදායකයේ සිදු කර ඇති ව්‍යතිරේක මේවාය.",
+22 -1
View File
@@ -1,6 +1,11 @@
import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrderedSet, fromJS } from 'immutable';
import { changeUploadCompose } from 'mastodon/actions/compose_typed';
import {
changeUploadCompose,
quoteComposeByStatus,
quoteComposeCancel,
setQuotePolicy,
} from 'mastodon/actions/compose_typed';
import { timelineDelete } from 'mastodon/actions/timelines_typed';
import {
@@ -83,6 +88,11 @@ const initialState = ImmutableMap({
resetFileKey: Math.floor((Math.random() * 0x10000)),
idempotencyKey: null,
tagHistory: ImmutableList(),
// Quotes
quoted_status_id: null,
quote_policy: 'public',
default_quote_policy: 'public', // Set in hydration.
});
const initialPoll = ImmutableMap({
@@ -117,6 +127,8 @@ function clearAll(state) {
map.set('progress', 0);
map.set('poll', null);
map.set('idempotencyKey', uuid());
map.set('quoted_status_id', null);
map.set('quote_policy', state.get('default_quote_policy'));
});
}
@@ -317,6 +329,15 @@ export const composeReducer = (state = initialState, action) => {
return state.set('is_changing_upload', true);
} else if (changeUploadCompose.rejected.match(action)) {
return state.set('is_changing_upload', false);
} else if (quoteComposeByStatus.match(action)) {
const status = action.payload;
if (status.getIn(['quote_approval', 'current_user']) === 'automatic') {
return state.set('quoted_status_id', status.get('id'));
}
} else if (quoteComposeCancel.match(action)) {
return state.set('quoted_status_id', null);
} else if (setQuotePolicy.match(action)) {
return state.set('quote_policy', action.payload);
}
switch(action.type) {
@@ -1,5 +1,12 @@
import type { GetThunkAPI } from '@reduxjs/toolkit';
import { createAsyncThunk, createSelector } from '@reduxjs/toolkit';
import type {
ActionCreatorWithPreparedPayload,
GetThunkAPI,
} from '@reduxjs/toolkit';
import {
createAsyncThunk as rtkCreateAsyncThunk,
createSelector,
createAction,
} from '@reduxjs/toolkit';
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { useDispatch, useSelector } from 'react-redux';
@@ -18,7 +25,7 @@ interface AppMeta {
useLoadingBar?: boolean;
}
export const createAppAsyncThunk = createAsyncThunk.withTypes<{
export const createAppAsyncThunk = rtkCreateAsyncThunk.withTypes<{
state: RootState;
dispatch: AppDispatch;
rejectValue: AsyncThunkRejectValue;
@@ -43,9 +50,88 @@ interface AppThunkOptions<Arg> {
) => boolean;
}
const createBaseAsyncThunk = createAsyncThunk.withTypes<AppThunkConfig>();
// Type definitions for the sync thunks.
type AppThunk<Arg = void, Returned = void> = (
arg: Arg,
) => (dispatch: AppDispatch, getState: () => RootState) => Returned;
export function createThunk<Arg = void, Returned = void>(
type AppThunkCreator<Arg = void, Returned = void, ExtraArg = unknown> = (
arg: Arg,
api: AppThunkApi,
extra?: ExtraArg,
) => Returned;
type AppThunkActionCreator<
Arg = void,
Returned = void,
> = ActionCreatorWithPreparedPayload<
[Returned, Arg],
Returned,
string,
never,
{ arg: Arg }
>;
// Version that does not dispatch it's own action.
export function createAppThunk<Arg = void, Returned = void, ExtraArg = unknown>(
creator: AppThunkCreator<Arg, Returned, ExtraArg>,
extra?: ExtraArg,
): AppThunk<Arg, Returned>;
// Version that dispatches an named action with the result of the creator callback.
export function createAppThunk<Arg = void, Returned = void, ExtraArg = unknown>(
name: string,
creator: AppThunkCreator<Arg, Returned, ExtraArg>,
extra?: ExtraArg,
): AppThunk<Arg, Returned> & AppThunkActionCreator<Arg, Returned>;
/** Creates a thunk that dispatches an action. */
export function createAppThunk<Arg = void, Returned = void, ExtraArg = unknown>(
nameOrCreator: string | AppThunkCreator<Arg, Returned, ExtraArg>,
maybeCreatorOrExtra?: AppThunkCreator<Arg, Returned, ExtraArg> | ExtraArg,
maybeExtra?: ExtraArg,
) {
const isDispatcher = typeof nameOrCreator === 'string';
const name = isDispatcher ? nameOrCreator : undefined;
const creator = isDispatcher
? (maybeCreatorOrExtra as AppThunkCreator<Arg, Returned, ExtraArg>)
: nameOrCreator;
const extra = isDispatcher ? maybeExtra : (maybeCreatorOrExtra as ExtraArg);
let action: null | AppThunkActionCreator<Arg, Returned> = null;
// Creates a thunk that dispatches the action with the result of the creator.
const actionCreator: AppThunk<Arg, Returned> = (arg) => {
return (dispatch, getState) => {
const result = creator(arg, { dispatch, getState }, extra);
if (action) {
// Dispatches the action with the result.
const actionObj = action(result, arg);
dispatch(actionObj);
}
return result;
};
};
// No action name provided, return the thunk directly.
if (!name) {
return actionCreator;
}
// Create the action and assign the action creator to it in order
// to have things like `toString` and `match` available.
action = createAction(name, (payload: Returned, arg: Arg) => ({
payload,
meta: {
arg,
},
}));
return Object.assign({}, action, actionCreator);
}
const createBaseAsyncThunk = rtkCreateAsyncThunk.withTypes<AppThunkConfig>();
export function createAsyncThunk<Arg = void, Returned = void>(
name: string,
creator: (arg: Arg, api: AppThunkApi) => Returned | Promise<Returned>,
options: AppThunkOptions<Arg> = {},
@@ -104,7 +190,7 @@ export function createDataLoadingThunk<LoadDataResult, Args extends ArgsType>(
name: string,
loadData: (args: Args) => Promise<LoadDataResult>,
thunkOptions?: AppThunkOptions<Args>,
): ReturnType<typeof createThunk<Args, LoadDataResult>>;
): ReturnType<typeof createAsyncThunk<Args, LoadDataResult>>;
// Overload when the `onData` method returns discardLoadDataInPayload, then the payload is empty
export function createDataLoadingThunk<LoadDataResult, Args extends ArgsType>(
@@ -114,7 +200,7 @@ export function createDataLoadingThunk<LoadDataResult, Args extends ArgsType>(
| AppThunkOptions<Args>
| OnData<Args, LoadDataResult, DiscardLoadData>,
thunkOptions?: AppThunkOptions<Args>,
): ReturnType<typeof createThunk<Args, void>>;
): ReturnType<typeof createAsyncThunk<Args, void>>;
// Overload when the `onData` method returns nothing, then the mayload is the `onData` result
export function createDataLoadingThunk<LoadDataResult, Args extends ArgsType>(
@@ -124,7 +210,7 @@ export function createDataLoadingThunk<LoadDataResult, Args extends ArgsType>(
| AppThunkOptions<Args>
| OnData<Args, LoadDataResult, void>,
thunkOptions?: AppThunkOptions<Args>,
): ReturnType<typeof createThunk<Args, LoadDataResult>>;
): ReturnType<typeof createAsyncThunk<Args, LoadDataResult>>;
// Overload when there is an `onData` method returning something
export function createDataLoadingThunk<
@@ -138,7 +224,7 @@ export function createDataLoadingThunk<
| AppThunkOptions<Args>
| OnData<Args, LoadDataResult, Returned>,
thunkOptions?: AppThunkOptions<Args>,
): ReturnType<typeof createThunk<Args, Returned>>;
): ReturnType<typeof createAsyncThunk<Args, Returned>>;
/**
* This function creates a Redux Thunk that handles loading data asynchronously (usually from the API), dispatching `pending`, `fullfilled` and `rejected` actions.
@@ -189,7 +275,7 @@ export function createDataLoadingThunk<
thunkOptions = maybeThunkOptions;
}
return createThunk<Args, Returned>(
return createAsyncThunk<Args, Returned>(
name,
async (arg, { getState, dispatch }) => {
const data = await loadData(arg, {