Allow translating more strings
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
afaedd622a
commit
2df8b927ea
19 changed files with 100 additions and 48 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import { defineMessages } from 'react-intl';
|
||||||
import api, { baseClient } from '../api';
|
import api, { baseClient } from '../api';
|
||||||
import { importFetchedAccount } from './importer';
|
import { importFetchedAccount } from './importer';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
import snackbar from 'soapbox/actions/snackbar';
|
||||||
|
@ -39,6 +40,11 @@ export const REVOKE_TOKEN_REQUEST = 'REVOKE_TOKEN_REQUEST';
|
||||||
export const REVOKE_TOKEN_SUCCESS = 'REVOKE_TOKEN_SUCCESS';
|
export const REVOKE_TOKEN_SUCCESS = 'REVOKE_TOKEN_SUCCESS';
|
||||||
export const REVOKE_TOKEN_FAIL = 'REVOKE_TOKEN_FAIL';
|
export const REVOKE_TOKEN_FAIL = 'REVOKE_TOKEN_FAIL';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
loggedOut: { id: 'auth.logged_out', defaultMessage: 'Logged out.' },
|
||||||
|
invalidCredentials: { id: 'auth.invalid_credentials', defaultMessage: 'Wrong username or password' },
|
||||||
|
});
|
||||||
|
|
||||||
const noOp = () => () => new Promise(f => f());
|
const noOp = () => () => new Promise(f => f());
|
||||||
|
|
||||||
function createAppAndToken() {
|
function createAppAndToken() {
|
||||||
|
@ -150,7 +156,7 @@ export function verifyCredentials(token) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function logIn(username, password) {
|
export function logIn(intl, username, password) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
return dispatch(createAppAndToken()).then(() => {
|
return dispatch(createAppAndToken()).then(() => {
|
||||||
return dispatch(createUserToken(username, password));
|
return dispatch(createUserToken(username, password));
|
||||||
|
@ -160,14 +166,14 @@ export function logIn(username, password) {
|
||||||
} else if(error.response.data.error) {
|
} else if(error.response.data.error) {
|
||||||
dispatch(snackbar.error(error.response.data.error));
|
dispatch(snackbar.error(error.response.data.error));
|
||||||
} else {
|
} else {
|
||||||
dispatch(snackbar.error('Wrong username or password'));
|
dispatch(snackbar.error(intl.formatMessage(messages.invalidCredentials)));
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function logOut() {
|
export function logOut(intl) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const me = state.get('me');
|
const me = state.get('me');
|
||||||
|
@ -178,7 +184,7 @@ export function logOut() {
|
||||||
token: state.getIn(['auth', 'users', me, 'access_token']),
|
token: state.getIn(['auth', 'users', me, 'access_token']),
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
dispatch({ type: AUTH_LOGGED_OUT, accountId: me });
|
dispatch({ type: AUTH_LOGGED_OUT, accountId: me });
|
||||||
dispatch(snackbar.success('Logged out.'));
|
dispatch(snackbar.success(intl.formatMessage(messages.loggedOut)));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -250,7 +256,7 @@ export function changeEmail(email, password) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteAccount(password) {
|
export function deleteAccount(intl, password) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch({ type: DELETE_ACCOUNT_REQUEST });
|
dispatch({ type: DELETE_ACCOUNT_REQUEST });
|
||||||
return api(getState).post('/api/pleroma/delete_account', {
|
return api(getState).post('/api/pleroma/delete_account', {
|
||||||
|
@ -259,7 +265,7 @@ export function deleteAccount(password) {
|
||||||
if (response.data.error) throw response.data.error; // This endpoint returns HTTP 200 even on failure
|
if (response.data.error) throw response.data.error; // This endpoint returns HTTP 200 even on failure
|
||||||
dispatch({ type: DELETE_ACCOUNT_SUCCESS, response });
|
dispatch({ type: DELETE_ACCOUNT_SUCCESS, response });
|
||||||
dispatch({ type: AUTH_LOGGED_OUT });
|
dispatch({ type: AUTH_LOGGED_OUT });
|
||||||
dispatch(snackbar.success('Logged out.'));
|
dispatch(snackbar.success(intl.formatMessage(messages.loggedOut)));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({ type: DELETE_ACCOUNT_FAIL, error, skipAlert: true });
|
dispatch({ type: DELETE_ACCOUNT_FAIL, error, skipAlert: true });
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { defineMessages } from 'react-intl';
|
||||||
import api from '../api';
|
import api from '../api';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
import snackbar from 'soapbox/actions/snackbar';
|
||||||
import { isLoggedIn } from 'soapbox/utils/auth';
|
import { isLoggedIn } from 'soapbox/utils/auth';
|
||||||
|
@ -14,6 +15,11 @@ export const FILTERS_DELETE_REQUEST = 'FILTERS_DELETE_REQUEST';
|
||||||
export const FILTERS_DELETE_SUCCESS = 'FILTERS_DELETE_SUCCESS';
|
export const FILTERS_DELETE_SUCCESS = 'FILTERS_DELETE_SUCCESS';
|
||||||
export const FILTERS_DELETE_FAIL = 'FILTERS_DELETE_FAIL';
|
export const FILTERS_DELETE_FAIL = 'FILTERS_DELETE_FAIL';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
added: { id: 'filters.added', defaultMessage: 'Filter added.' },
|
||||||
|
removed: { id: 'filters.removed', defaultMessage: 'Filter deleted.' },
|
||||||
|
});
|
||||||
|
|
||||||
export const fetchFilters = () => (dispatch, getState) => {
|
export const fetchFilters = () => (dispatch, getState) => {
|
||||||
if (!isLoggedIn(getState)) return;
|
if (!isLoggedIn(getState)) return;
|
||||||
|
|
||||||
|
@ -37,7 +43,7 @@ export const fetchFilters = () => (dispatch, getState) => {
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
export function createFilter(phrase, expires_at, context, whole_word, irreversible) {
|
export function createFilter(intl, phrase, expires_at, context, whole_word, irreversible) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch({ type: FILTERS_CREATE_REQUEST });
|
dispatch({ type: FILTERS_CREATE_REQUEST });
|
||||||
return api(getState).post('/api/v1/filters', {
|
return api(getState).post('/api/v1/filters', {
|
||||||
|
@ -48,7 +54,7 @@ export function createFilter(phrase, expires_at, context, whole_word, irreversib
|
||||||
expires_at,
|
expires_at,
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
dispatch({ type: FILTERS_CREATE_SUCCESS, filter: response.data });
|
dispatch({ type: FILTERS_CREATE_SUCCESS, filter: response.data });
|
||||||
dispatch(snackbar.success('Filter added.'));
|
dispatch(snackbar.success(intl.formatMessage(messages.added)));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({ type: FILTERS_CREATE_FAIL, error });
|
dispatch({ type: FILTERS_CREATE_FAIL, error });
|
||||||
});
|
});
|
||||||
|
@ -56,12 +62,12 @@ export function createFilter(phrase, expires_at, context, whole_word, irreversib
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function deleteFilter(id) {
|
export function deleteFilter(intl, id) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch({ type: FILTERS_DELETE_REQUEST });
|
dispatch({ type: FILTERS_DELETE_REQUEST });
|
||||||
return api(getState).delete('/api/v1/filters/'+id).then(response => {
|
return api(getState).delete('/api/v1/filters/'+id).then(response => {
|
||||||
dispatch({ type: FILTERS_DELETE_SUCCESS, filter: response.data });
|
dispatch({ type: FILTERS_DELETE_SUCCESS, filter: response.data });
|
||||||
dispatch(snackbar.success('Filter deleted.'));
|
dispatch(snackbar.success(intl.formatMessage(messages.removed)));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({ type: FILTERS_DELETE_FAIL, error });
|
dispatch({ type: FILTERS_DELETE_FAIL, error });
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { defineMessages } from 'react-intl';
|
||||||
import api from '../api';
|
import api from '../api';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
import snackbar from 'soapbox/actions/snackbar';
|
||||||
|
|
||||||
|
@ -13,13 +14,19 @@ export const IMPORT_MUTES_REQUEST = 'IMPORT_MUTES_REQUEST';
|
||||||
export const IMPORT_MUTES_SUCCESS = 'IMPORT_MUTES_SUCCESS';
|
export const IMPORT_MUTES_SUCCESS = 'IMPORT_MUTES_SUCCESS';
|
||||||
export const IMPORT_MUTES_FAIL = 'IMPORT_MUTES_FAIL';
|
export const IMPORT_MUTES_FAIL = 'IMPORT_MUTES_FAIL';
|
||||||
|
|
||||||
export function importFollows(params) {
|
const messages = defineMessages({
|
||||||
|
blocksSuccess: { id: 'import_data.success.blocks', defaultMessage: 'Blocks imported successfully' },
|
||||||
|
followersSuccess: { id: 'import_data.success.followers', defaultMessage: 'Followers imported successfully' },
|
||||||
|
mutesSuccess: { id: 'import_data.success.mutes', defaultMessage: 'Mutes imported successfully' },
|
||||||
|
});
|
||||||
|
|
||||||
|
export function importFollows(intl, params) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch({ type: IMPORT_FOLLOWS_REQUEST });
|
dispatch({ type: IMPORT_FOLLOWS_REQUEST });
|
||||||
return api(getState)
|
return api(getState)
|
||||||
.post('/api/pleroma/follow_import', params)
|
.post('/api/pleroma/follow_import', params)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
dispatch(snackbar.success('Followers imported successfully'));
|
dispatch(snackbar.success(intl.formatMessage(messages.followersSuccess)));
|
||||||
dispatch({ type: IMPORT_FOLLOWS_SUCCESS, config: response.data });
|
dispatch({ type: IMPORT_FOLLOWS_SUCCESS, config: response.data });
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({ type: IMPORT_FOLLOWS_FAIL, error });
|
dispatch({ type: IMPORT_FOLLOWS_FAIL, error });
|
||||||
|
@ -27,13 +34,13 @@ export function importFollows(params) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function importBlocks(params) {
|
export function importBlocks(intl, params) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch({ type: IMPORT_BLOCKS_REQUEST });
|
dispatch({ type: IMPORT_BLOCKS_REQUEST });
|
||||||
return api(getState)
|
return api(getState)
|
||||||
.post('/api/pleroma/blocks_import', params)
|
.post('/api/pleroma/blocks_import', params)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
dispatch(snackbar.success('Blocks imported successfully'));
|
dispatch(snackbar.success(intl.formatMessage(messages.blocksSuccess)));
|
||||||
dispatch({ type: IMPORT_BLOCKS_SUCCESS, config: response.data });
|
dispatch({ type: IMPORT_BLOCKS_SUCCESS, config: response.data });
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({ type: IMPORT_BLOCKS_FAIL, error });
|
dispatch({ type: IMPORT_BLOCKS_FAIL, error });
|
||||||
|
@ -41,13 +48,13 @@ export function importBlocks(params) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function importMutes(params) {
|
export function importMutes(intl, params) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch({ type: IMPORT_MUTES_REQUEST });
|
dispatch({ type: IMPORT_MUTES_REQUEST });
|
||||||
return api(getState)
|
return api(getState)
|
||||||
.post('/api/pleroma/mutes_import', params)
|
.post('/api/pleroma/mutes_import', params)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
dispatch(snackbar.success('Mutes imported successfully'));
|
dispatch(snackbar.success(intl.formatMessage(messages.mutesSuccess)));
|
||||||
dispatch({ type: IMPORT_MUTES_SUCCESS, config: response.data });
|
dispatch({ type: IMPORT_MUTES_SUCCESS, config: response.data });
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({ type: IMPORT_MUTES_FAIL, error });
|
dispatch({ type: IMPORT_MUTES_FAIL, error });
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { defineMessages } from 'react-intl';
|
||||||
import api from '../api';
|
import api from '../api';
|
||||||
import { importFetchedAccounts, importFetchedStatus } from './importer';
|
import { importFetchedAccounts, importFetchedStatus } from './importer';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
import snackbar from 'soapbox/actions/snackbar';
|
||||||
|
@ -43,6 +44,11 @@ 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';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
bookmarkAdded: { id: 'status.bookmarked', defaultMessage: 'Bookmark added.' },
|
||||||
|
bookmarkRemoved: { id: 'status.unbookmarked', defaultMessage: 'Bookmark removed.' },
|
||||||
|
});
|
||||||
|
|
||||||
export function reblog(status) {
|
export function reblog(status) {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
if (!isLoggedIn(getState)) return;
|
if (!isLoggedIn(getState)) return;
|
||||||
|
@ -205,28 +211,28 @@ export function unfavouriteFail(status, error) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function bookmark(status) {
|
export function bookmark(intl, status) {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
dispatch(bookmarkRequest(status));
|
dispatch(bookmarkRequest(status));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${status.get('id')}/bookmark`).then(function(response) {
|
api(getState).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));
|
||||||
dispatch(snackbar.success('Bookmark added'));
|
dispatch(snackbar.success(intl.formatMessage(messages.bookmarkAdded)));
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
dispatch(bookmarkFail(status, error));
|
dispatch(bookmarkFail(status, error));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function unbookmark(status) {
|
export function unbookmark(intl, status) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch(unbookmarkRequest(status));
|
dispatch(unbookmarkRequest(status));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${status.get('id')}/unbookmark`).then(response => {
|
api(getState).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));
|
||||||
dispatch(snackbar.success('Bookmark removed'));
|
dispatch(snackbar.success(intl.formatMessage(messages.bookmarkRemoved)));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(unbookmarkFail(status, error));
|
dispatch(unbookmarkFail(status, error));
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,12 +70,12 @@ const mapStateToProps = state => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
onClose() {
|
onClose() {
|
||||||
dispatch(closeSidebar());
|
dispatch(closeSidebar());
|
||||||
},
|
},
|
||||||
onClickLogOut(e) {
|
onClickLogOut(e) {
|
||||||
dispatch(logOut());
|
dispatch(logOut(intl));
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
},
|
},
|
||||||
fetchOwnAccounts() {
|
fetchOwnAccounts() {
|
||||||
|
|
|
@ -107,9 +107,9 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
|
|
||||||
onBookmark(status) {
|
onBookmark(status) {
|
||||||
if (status.get('bookmarked')) {
|
if (status.get('bookmarked')) {
|
||||||
dispatch(unbookmark(status));
|
dispatch(unbookmark(intl, status));
|
||||||
} else {
|
} else {
|
||||||
dispatch(bookmark(status));
|
dispatch(bookmark(intl, status));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { Redirect } from 'react-router-dom';
|
import { Redirect } from 'react-router-dom';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
import { injectIntl } from 'react-intl';
|
||||||
import LoginForm from './login_form';
|
import LoginForm from './login_form';
|
||||||
import OtpAuthForm from './otp_auth_form';
|
import OtpAuthForm from './otp_auth_form';
|
||||||
import { logIn, verifyCredentials, switchAccount } from 'soapbox/actions/auth';
|
import { logIn, verifyCredentials, switchAccount } from 'soapbox/actions/auth';
|
||||||
|
@ -12,6 +13,7 @@ const mapStateToProps = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
export default @connect(mapStateToProps)
|
export default @connect(mapStateToProps)
|
||||||
|
@injectIntl
|
||||||
class LoginPage extends ImmutablePureComponent {
|
class LoginPage extends ImmutablePureComponent {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -33,9 +35,9 @@ class LoginPage extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit = (event) => {
|
handleSubmit = (event) => {
|
||||||
const { dispatch, me } = this.props;
|
const { dispatch, intl, me } = this.props;
|
||||||
const { username, password } = this.getFormData(event.target);
|
const { username, password } = this.getFormData(event.target);
|
||||||
dispatch(logIn(username, password)).then(({ access_token }) => {
|
dispatch(logIn(intl, username, password)).then(({ access_token }) => {
|
||||||
return dispatch(verifyCredentials(access_token));
|
return dispatch(verifyCredentials(access_token));
|
||||||
}).then(account => {
|
}).then(account => {
|
||||||
this.setState({ shouldRedirect: true });
|
this.setState({ shouldRedirect: true });
|
||||||
|
|
|
@ -1,12 +1,19 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
|
||||||
import { resetPassword } from 'soapbox/actions/auth';
|
import { resetPassword } from 'soapbox/actions/auth';
|
||||||
import { SimpleForm, FieldsGroup, TextInput } from 'soapbox/features/forms';
|
import { SimpleForm, FieldsGroup, TextInput } from 'soapbox/features/forms';
|
||||||
import { Redirect } from 'react-router-dom';
|
import { Redirect } from 'react-router-dom';
|
||||||
import snackbar from 'soapbox/actions/snackbar';
|
import snackbar from 'soapbox/actions/snackbar';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
nicknameOrEmail: { id: 'password_reset.fields.username_placeholder', defaultMessage: 'Email or username' },
|
||||||
|
confirmation: { id: 'password_reset.confirmation', defaultMessage: 'Check your email for confirmation.' },
|
||||||
|
});
|
||||||
|
|
||||||
export default @connect()
|
export default @connect()
|
||||||
|
@injectIntl
|
||||||
class PasswordReset extends ImmutablePureComponent {
|
class PasswordReset extends ImmutablePureComponent {
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
@ -15,18 +22,20 @@ class PasswordReset extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit = e => {
|
handleSubmit = e => {
|
||||||
const { dispatch } = this.props;
|
const { dispatch, intl } = this.props;
|
||||||
const nicknameOrEmail = e.target.nickname_or_email.value;
|
const nicknameOrEmail = e.target.nickname_or_email.value;
|
||||||
this.setState({ isLoading: true });
|
this.setState({ isLoading: true });
|
||||||
dispatch(resetPassword(nicknameOrEmail)).then(() => {
|
dispatch(resetPassword(nicknameOrEmail)).then(() => {
|
||||||
this.setState({ isLoading: false, success: true });
|
this.setState({ isLoading: false, success: true });
|
||||||
dispatch(snackbar.info('Check your email for confirmation.'));
|
dispatch(snackbar.info(intl.formatMessage(messages.confirmation)));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.setState({ isLoading: false });
|
this.setState({ isLoading: false });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { intl } = this.props;
|
||||||
|
|
||||||
if (this.state.success) return <Redirect to='/' />;
|
if (this.state.success) return <Redirect to='/' />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -35,14 +44,16 @@ class PasswordReset extends ImmutablePureComponent {
|
||||||
<FieldsGroup>
|
<FieldsGroup>
|
||||||
<TextInput
|
<TextInput
|
||||||
name='nickname_or_email'
|
name='nickname_or_email'
|
||||||
label='Email or username'
|
label={intl.formatMessage(messages.nicknameOrEmail)}
|
||||||
placeholder='me@example.com'
|
placeholder='me@example.com'
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</FieldsGroup>
|
</FieldsGroup>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div className='actions'>
|
<div className='actions'>
|
||||||
<button name='button' type='submit' className='btn button button-primary'>Reset password</button>
|
<button name='button' type='submit' className='btn button button-primary'>
|
||||||
|
<FormattedMessage id='password_reset.reset' defaultMessage='Reset password' />
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</SimpleForm>
|
</SimpleForm>
|
||||||
);
|
);
|
||||||
|
|
|
@ -34,12 +34,12 @@ const mapStateToProps = state => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
onOpenHotkeys() {
|
onOpenHotkeys() {
|
||||||
dispatch(openModal('HOTKEYS'));
|
dispatch(openModal('HOTKEYS'));
|
||||||
},
|
},
|
||||||
onClickLogOut(e) {
|
onClickLogOut(e) {
|
||||||
dispatch(logOut());
|
dispatch(logOut(intl));
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,6 +39,7 @@ const messages = defineMessages({
|
||||||
metaFieldLabel: { id: 'edit_profile.fields.meta_fields.label_placeholder', defaultMessage: 'Label' },
|
metaFieldLabel: { id: 'edit_profile.fields.meta_fields.label_placeholder', defaultMessage: 'Label' },
|
||||||
metaFieldContent: { id: 'edit_profile.fields.meta_fields.content_placeholder', defaultMessage: 'Content' },
|
metaFieldContent: { id: 'edit_profile.fields.meta_fields.content_placeholder', defaultMessage: 'Content' },
|
||||||
verified: { id: 'edit_profile.fields.verified_display_name', defaultMessage: 'Verified users may not update their display name' },
|
verified: { id: 'edit_profile.fields.verified_display_name', defaultMessage: 'Verified users may not update their display name' },
|
||||||
|
success: { id: 'edit_profile.success', defaultMessage: 'Profile saved!' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
|
@ -150,7 +151,7 @@ class EditProfile extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit = (event) => {
|
handleSubmit = (event) => {
|
||||||
const { dispatch } = this.props;
|
const { dispatch, intl } = this.props;
|
||||||
|
|
||||||
const credentials = dispatch(patchMe(this.getFormdata()));
|
const credentials = dispatch(patchMe(this.getFormdata()));
|
||||||
const notifications = dispatch(updateNotificationSettings({
|
const notifications = dispatch(updateNotificationSettings({
|
||||||
|
@ -161,7 +162,7 @@ class EditProfile extends ImmutablePureComponent {
|
||||||
|
|
||||||
Promise.all([credentials, notifications]).then(() => {
|
Promise.all([credentials, notifications]).then(() => {
|
||||||
this.setState({ isLoading: false });
|
this.setState({ isLoading: false });
|
||||||
dispatch(snackbar.success('Profile saved!'));
|
dispatch(snackbar.success(intl.formatMessage(messages.success)));
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
this.setState({ isLoading: false });
|
this.setState({ isLoading: false });
|
||||||
});
|
});
|
||||||
|
|
|
@ -111,7 +111,7 @@ class Filters extends ImmutablePureComponent {
|
||||||
context.push('thread');
|
context.push('thread');
|
||||||
};
|
};
|
||||||
|
|
||||||
dispatch(createFilter(phrase, expires_at, context, whole_word, irreversible)).then(response => {
|
dispatch(createFilter(intl, phrase, expires_at, context, whole_word, irreversible)).then(response => {
|
||||||
return dispatch(fetchFilters());
|
return dispatch(fetchFilters());
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.create_error)));
|
dispatch(snackbar.error(intl.formatMessage(messages.create_error)));
|
||||||
|
@ -120,7 +120,7 @@ class Filters extends ImmutablePureComponent {
|
||||||
|
|
||||||
handleFilterDelete = e => {
|
handleFilterDelete = e => {
|
||||||
const { intl, dispatch } = this.props;
|
const { intl, dispatch } = this.props;
|
||||||
dispatch(deleteFilter(e.currentTarget.dataset.value)).then(response => {
|
dispatch(deleteFilter(intl, e.currentTarget.dataset.value)).then(response => {
|
||||||
return dispatch(fetchFilters());
|
return dispatch(fetchFilters());
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(snackbar.error(intl.formatMessage(messages.delete_error)));
|
dispatch(snackbar.error(intl.formatMessage(messages.delete_error)));
|
||||||
|
|
|
@ -26,13 +26,13 @@ class CSVImporter extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit = (event) => {
|
handleSubmit = (event) => {
|
||||||
const { dispatch, action } = this.props;
|
const { dispatch, action, intl } = this.props;
|
||||||
|
|
||||||
let params = new FormData();
|
let params = new FormData();
|
||||||
params.append('list', this.state.file);
|
params.append('list', this.state.file);
|
||||||
|
|
||||||
this.setState({ isLoading: true });
|
this.setState({ isLoading: true });
|
||||||
dispatch(action(params)).then(() => {
|
dispatch(action(intl, params)).then(() => {
|
||||||
this.setState({ isLoading: false });
|
this.setState({ isLoading: false });
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
this.setState({ isLoading: false });
|
this.setState({ isLoading: false });
|
||||||
|
|
|
@ -52,9 +52,9 @@ class Header extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleSubmit = (event) => {
|
handleSubmit = (event) => {
|
||||||
const { dispatch } = this.props;
|
const { dispatch, intl } = this.props;
|
||||||
const { username, password } = this.getFormData(event.target);
|
const { username, password } = this.getFormData(event.target);
|
||||||
dispatch(logIn(username, password)).then(({ access_token }) => {
|
dispatch(logIn(intl, username, password)).then(({ access_token }) => {
|
||||||
return dispatch(verifyCredentials(access_token));
|
return dispatch(verifyCredentials(access_token));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
if (error.response.data.error === 'mfa_required') {
|
if (error.response.data.error === 'mfa_required') {
|
||||||
|
|
|
@ -371,7 +371,7 @@ class DeactivateAccount extends ImmutablePureComponent {
|
||||||
const { password } = this.state;
|
const { password } = this.state;
|
||||||
const { dispatch, intl } = this.props;
|
const { dispatch, intl } = this.props;
|
||||||
this.setState({ isLoading: true });
|
this.setState({ isLoading: true });
|
||||||
return dispatch(deleteAccount(password)).then(() => {
|
return dispatch(deleteAccount(intl, password)).then(() => {
|
||||||
//this.setState({ email: '', password: '' }); // TODO: Maybe redirect user
|
//this.setState({ email: '', password: '' }); // TODO: Maybe redirect user
|
||||||
dispatch(snackbar.success(intl.formatMessage(messages.deleteAccountSuccess)));
|
dispatch(snackbar.success(intl.formatMessage(messages.deleteAccountSuccess)));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
|
@ -93,9 +93,9 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
|
|
||||||
onBookmark(status) {
|
onBookmark(status) {
|
||||||
if (status.get('bookmarked')) {
|
if (status.get('bookmarked')) {
|
||||||
dispatch(unbookmark(status));
|
dispatch(unbookmark(intl, status));
|
||||||
} else {
|
} else {
|
||||||
dispatch(bookmark(status));
|
dispatch(bookmark(intl, status));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -177,9 +177,9 @@ class Status extends ImmutablePureComponent {
|
||||||
|
|
||||||
handleBookmark = (status) => {
|
handleBookmark = (status) => {
|
||||||
if (status.get('bookmarked')) {
|
if (status.get('bookmarked')) {
|
||||||
this.props.dispatch(unbookmark(status));
|
this.props.dispatch(unbookmark(this.props.intl, status));
|
||||||
} else {
|
} else {
|
||||||
this.props.dispatch(bookmark(status));
|
this.props.dispatch(bookmark(this.props.intl, status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,12 @@ const mapStateToProps = state => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
onOpenHotkeys() {
|
onOpenHotkeys() {
|
||||||
dispatch(openModal('HOTKEYS'));
|
dispatch(openModal('HOTKEYS'));
|
||||||
},
|
},
|
||||||
onClickLogOut(e) {
|
onClickLogOut(e) {
|
||||||
dispatch(logOut());
|
dispatch(logOut(intl));
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -53,7 +53,7 @@ class ProfileDropdown extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLogOut = e => {
|
handleLogOut = e => {
|
||||||
this.props.dispatch(logOut());
|
this.props.dispatch(logOut(this.props.intl));
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@
|
||||||
"account.unmute_notifications": "Cofnij wyciszenie powiadomień od @{name}",
|
"account.unmute_notifications": "Cofnij wyciszenie powiadomień od @{name}",
|
||||||
"account.unsubscribe": "Przestań subskrybować wpisy @{name}",
|
"account.unsubscribe": "Przestań subskrybować wpisy @{name}",
|
||||||
"account_gallery.none": "Brak zawartości multimedialnej do wyświetlenia.",
|
"account_gallery.none": "Brak zawartości multimedialnej do wyświetlenia.",
|
||||||
|
"auth.invalid_credentials": "Nieprawidłowa nazwa użytkownika lub hasło",
|
||||||
|
"auth.logged_out": "Wylogowano.",
|
||||||
"admin.awaiting_approval.approved_message": "Przyjęto {acct}!",
|
"admin.awaiting_approval.approved_message": "Przyjęto {acct}!",
|
||||||
"admin.awaiting_approval.empty_message": "Nikt nie oczekuje przyjęcia. Gdy zarejestruje się nowy użytkownik, możesz zatwierdzić go tutaj.",
|
"admin.awaiting_approval.empty_message": "Nikt nie oczekuje przyjęcia. Gdy zarejestruje się nowy użytkownik, możesz zatwierdzić go tutaj.",
|
||||||
"admin.awaiting_approval.rejected_message": "Odrzucono {acct}!",
|
"admin.awaiting_approval.rejected_message": "Odrzucono {acct}!",
|
||||||
|
@ -257,6 +259,7 @@
|
||||||
"edit_profile.hints.meta_fields": "Możesz mieć maksymalnie {count, plural, one {# element} few {# elemeny} many {# elementów} other {# elementy}} wyświetlane w formie tabeli na swoim profilu",
|
"edit_profile.hints.meta_fields": "Możesz mieć maksymalnie {count, plural, one {# element} few {# elemeny} many {# elementów} other {# elementy}} wyświetlane w formie tabeli na swoim profilu",
|
||||||
"edit_profile.hints.stranger_notifications": "Wyświetlaj tylko powiadomienia od osób, które obserwujesz",
|
"edit_profile.hints.stranger_notifications": "Wyświetlaj tylko powiadomienia od osób, które obserwujesz",
|
||||||
"edit_profile.save": "Zapisz",
|
"edit_profile.save": "Zapisz",
|
||||||
|
"edit_profile.success": "Zapisano profil!",
|
||||||
"embed.instructions": "Osadź ten wpis na swojej stronie wklejając poniższy kod.",
|
"embed.instructions": "Osadź ten wpis na swojej stronie wklejając poniższy kod.",
|
||||||
"embed.preview": "Tak będzie to wyglądać:",
|
"embed.preview": "Tak będzie to wyglądać:",
|
||||||
"emoji_button.activity": "Aktywność",
|
"emoji_button.activity": "Aktywność",
|
||||||
|
@ -306,6 +309,8 @@
|
||||||
"filters.filters_list_hide": "Ukrywaj",
|
"filters.filters_list_hide": "Ukrywaj",
|
||||||
"filters.filters_list_phrase_label": "Słowo kluczowe lub fraza:",
|
"filters.filters_list_phrase_label": "Słowo kluczowe lub fraza:",
|
||||||
"filters.filters_list_whole-word": "Całe słowo",
|
"filters.filters_list_whole-word": "Całe słowo",
|
||||||
|
"filters.added": "Dodano filtr.",
|
||||||
|
"filters.deleted": "Usunięto filtr.",
|
||||||
"follow_request.authorize": "Autoryzuj",
|
"follow_request.authorize": "Autoryzuj",
|
||||||
"follow_request.reject": "Odrzuć",
|
"follow_request.reject": "Odrzuć",
|
||||||
"forms.copy": "Kopiuj",
|
"forms.copy": "Kopiuj",
|
||||||
|
@ -354,6 +359,9 @@
|
||||||
"import_data.hints.follows": "Plik CSV zawierający listę obserwowanych kont",
|
"import_data.hints.follows": "Plik CSV zawierający listę obserwowanych kont",
|
||||||
"import_data.hints.mutes": "Plik CSV zawierający listę wyciszonych kont",
|
"import_data.hints.mutes": "Plik CSV zawierający listę wyciszonych kont",
|
||||||
"import_data.mutes_label": "Wyciszenia",
|
"import_data.mutes_label": "Wyciszenia",
|
||||||
|
"import_data.success.blocks": "Pomyślnie zaimportowano zablokowane konta",
|
||||||
|
"import_data.success.followers": "Pomyślnie zaimportowano obserwowane konta",
|
||||||
|
"import_data.success.mutes": "Pomyślnie zaimportowano wyciszone konta",
|
||||||
"intervals.full.days": "{number, plural, one {# dzień} few {# dni} many {# dni} other {# dni}}",
|
"intervals.full.days": "{number, plural, one {# dzień} few {# dni} many {# dni} other {# dni}}",
|
||||||
"intervals.full.hours": "{number, plural, one {# godzina} few {# godziny} many {# godzin} other {# godzin}}",
|
"intervals.full.hours": "{number, plural, one {# godzina} few {# godziny} many {# godzin} other {# godzin}}",
|
||||||
"intervals.full.minutes": "{number, plural, one {# minuta} few {# minuty} many {# minut} other {# minut}}",
|
"intervals.full.minutes": "{number, plural, one {# minuta} few {# minuty} many {# minut} other {# minut}}",
|
||||||
|
@ -487,6 +495,9 @@
|
||||||
"notifications.filter.polls": "Wyniki głosowania",
|
"notifications.filter.polls": "Wyniki głosowania",
|
||||||
"notifications.group": "{count, number} {count, plural, one {powiadomienie} few {powiadomienia} many {powiadomień} more {powiadomień}}",
|
"notifications.group": "{count, number} {count, plural, one {powiadomienie} few {powiadomienia} many {powiadomień} more {powiadomień}}",
|
||||||
"notifications.queue_label": "Naciśnij aby zobaczyć {count} {count, plural, one {nowe powiadomienie} few {nowe powiadomienia} many {nowych powiadomień} other {nowe powiadomienia}}",
|
"notifications.queue_label": "Naciśnij aby zobaczyć {count} {count, plural, one {nowe powiadomienie} few {nowe powiadomienia} many {nowych powiadomień} other {nowe powiadomienia}}",
|
||||||
|
"password_reset.confirmation": "Sprawdź swoją pocztę e-mail, aby potwierdzić.",
|
||||||
|
"password_reset.fields.username_placeholder": "Adres e-mail lub nazwa użytkownika",
|
||||||
|
"password_reset.reset": "Resetuj hasło",
|
||||||
"pinned_statuses.none": "Brak przypięć do pokazania.",
|
"pinned_statuses.none": "Brak przypięć do pokazania.",
|
||||||
"poll.closed": "Zamknięte",
|
"poll.closed": "Zamknięte",
|
||||||
"poll.refresh": "Odśwież",
|
"poll.refresh": "Odśwież",
|
||||||
|
@ -646,6 +657,7 @@
|
||||||
"status.admin_status": "Otwórz ten wpis w interfejsie moderacyjnym",
|
"status.admin_status": "Otwórz ten wpis w interfejsie moderacyjnym",
|
||||||
"status.block": "Zablokuj @{name}",
|
"status.block": "Zablokuj @{name}",
|
||||||
"status.bookmark": "Dodaj do zakładek",
|
"status.bookmark": "Dodaj do zakładek",
|
||||||
|
"status.bookmarked": "Dodano do zakładek.",
|
||||||
"status.cancel_reblog_private": "Cofnij podbicie",
|
"status.cancel_reblog_private": "Cofnij podbicie",
|
||||||
"status.cannot_reblog": "Ten wpis nie może zostać podbity",
|
"status.cannot_reblog": "Ten wpis nie może zostać podbity",
|
||||||
"status.copy": "Skopiuj odnośnik do wpisu",
|
"status.copy": "Skopiuj odnośnik do wpisu",
|
||||||
|
@ -683,6 +695,7 @@
|
||||||
"status.show_more_all": "Rozwiń wszystkie",
|
"status.show_more_all": "Rozwiń wszystkie",
|
||||||
"status.show_thread": "Pokaż wątek",
|
"status.show_thread": "Pokaż wątek",
|
||||||
"status.unbookmark": "Usuń z zakładek",
|
"status.unbookmark": "Usuń z zakładek",
|
||||||
|
"status.unbookmarked": "Usunięto z zakładek.",
|
||||||
"status.unmute_conversation": "Cofnij wyciszenie konwersacji",
|
"status.unmute_conversation": "Cofnij wyciszenie konwersacji",
|
||||||
"status.unpin": "Odepnij z profilu",
|
"status.unpin": "Odepnij z profilu",
|
||||||
"status_list.queue_label": "Naciśnij aby zobaczyć {count} {count, plural, one {nowy wpis} few {nowe wpisy} many {nowych wpisów} other {nowe wpisy}}",
|
"status_list.queue_label": "Naciśnij aby zobaczyć {count} {count, plural, one {nowy wpis} few {nowe wpisy} many {nowych wpisów} other {nowe wpisy}}",
|
||||||
|
|
Loading…
Reference in a new issue