mirror of
https://github.com/wassname/talk.git
synced 2026-08-18 12:30:39 +08:00
Restore error functionality
This commit is contained in:
@@ -23,7 +23,7 @@ export const handleLogin = (email, password, recaptchaResponse) => (dispatch) =>
|
||||
dispatch(checkLoginSuccess(user));
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.translation_key === 'login_maximum_exceeded') {
|
||||
if (error.translation_key === 'LOGIN_MAXIMUM_EXCEEDED') {
|
||||
dispatch({
|
||||
type: actions.LOGIN_MAXIMUM_EXCEEDED,
|
||||
message: error.translation_key
|
||||
|
||||
@@ -36,7 +36,7 @@ export class CountdownSeconds extends React.Component {
|
||||
const secRemaining = msRemaining / 1000;
|
||||
const wholeSecRemaining = Math.floor(secRemaining);
|
||||
const plural = secRemaining !== 1;
|
||||
const units = t(plural ? 'edit_comment.secondsPlural' : 'edit_comment.second');
|
||||
const units = t(plural ? 'edit_comment.seconds_plural' : 'edit_comment.second');
|
||||
let classFromProp;
|
||||
if (typeof classNameForMsRemaining === 'function') {
|
||||
classFromProp = classNameForMsRemaining(msRemaining);
|
||||
|
||||
@@ -83,9 +83,9 @@ export class EditableCommentContent extends React.Component {
|
||||
if (error.translation_key) {
|
||||
addNotification('error', t(`error.${error.translation_key}`));
|
||||
} else if (error.networkError) {
|
||||
addNotification('error', t('error.networkError'));
|
||||
addNotification('error', t('error.network_error'));
|
||||
} else {
|
||||
addNotification('error', t('edit_comment.unexpectedError'));
|
||||
addNotification('error', t('edit_comment.unexpected_error'));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ export class EditableCommentContent extends React.Component {
|
||||
return (comment.body !== originalBody) && !editWindowExpired;
|
||||
}}
|
||||
saveComment={this.editComment}
|
||||
bodyLabel={t('edit_comment.bodyInputLabel')}
|
||||
bodyLabel={t('edit_comment.body_input_label')}
|
||||
bodyPlaceholder=""
|
||||
submitText={<span>{t('edit_comment.save_button')}</span>}
|
||||
saveButtonCStyle="green"
|
||||
@@ -126,15 +126,15 @@ export class EditableCommentContent extends React.Component {
|
||||
{
|
||||
editWindowExpired
|
||||
? <span>
|
||||
{t('edit_comment.editWindowExpired')}
|
||||
{t('edit_comment.edit_window_expired')}
|
||||
{
|
||||
typeof this.props.stopEditing === 'function'
|
||||
? <span> <a className={styles.link} onClick={this.props.stopEditing}>{t('edit_comment.editWindowExpiredClose')}</a></span>
|
||||
? <span> <a className={styles.link} onClick={this.props.stopEditing}>{t('edit_comment.edit_window_expired_close')}</a></span>
|
||||
: null
|
||||
}
|
||||
</span>
|
||||
: <span>
|
||||
<Icon name="timer"/> {t('edit_comment.editWindowTimerPrefix')}
|
||||
<Icon name="timer"/> {t('edit_comment.edit_window_timer_prefix')}
|
||||
<CountdownSeconds
|
||||
until={editableUntil}
|
||||
classNameForMsRemaining={(remainingMs) => (remainingMs <= 10 * 1000) ? styles.editWindowAlmostOver : '' }
|
||||
|
||||
Reference in New Issue
Block a user