mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 16:00:54 +08:00
Merge branch 'master' into flags-locales
This commit is contained in:
@@ -10,6 +10,8 @@ const shortcuts = [
|
||||
shortcuts: {
|
||||
'j': 'modqueue.next_comment',
|
||||
'k': 'modqueue.prev_comment',
|
||||
'ctrl+f': 'modqueue.toggle_search',
|
||||
't': 'modqueue.next_queue',
|
||||
's': 'modqueue.singleview',
|
||||
'?': 'modqueue.thismenu'
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
.header > div {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
width: 1280px;
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
height: 58px;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ class Moderation extends Component {
|
||||
key('s', () => singleView());
|
||||
key('shift+/', () => toggleModal(true));
|
||||
key('esc', () => toggleModal(false));
|
||||
key('ctrl+f', () => this.openSearch());
|
||||
key('t', () => this.nextQueue());
|
||||
key('j', () => this.select(true));
|
||||
key('k', () => this.select(false));
|
||||
key('f', () => this.moderate(false));
|
||||
@@ -36,6 +38,21 @@ class Moderation extends Component {
|
||||
this.props.toggleModal(false);
|
||||
}
|
||||
|
||||
nextQueue = () => {
|
||||
const queueConfig = this.props.queueConfig;
|
||||
const activeTab = this.props.activeTab;
|
||||
const assetId = this.props.data.variables.asset_id;
|
||||
|
||||
const menuItems = Object.keys(queueConfig).map((queue) => ({
|
||||
key: queue
|
||||
}));
|
||||
|
||||
const activeTabIndex = menuItems.findIndex((item) => item.key === activeTab);
|
||||
const nextQueueIndex = (activeTabIndex === menuItems.length - 1) ? 0 : activeTabIndex + 1;
|
||||
|
||||
this.props.router.push(this.props.getModPath(menuItems[nextQueueIndex].key, assetId));
|
||||
}
|
||||
|
||||
closeSearch = () => {
|
||||
const {toggleStorySearch} = this.props;
|
||||
toggleStorySearch(false);
|
||||
@@ -53,14 +70,17 @@ class Moderation extends Component {
|
||||
const {acceptComment, rejectComment} = this.props;
|
||||
const {selectedCommentId} = this.state;
|
||||
|
||||
const comments = this.getComments();
|
||||
const commentIdx = comments.findIndex((comment) => comment.id === selectedCommentId);
|
||||
const comment = comments[commentIdx];
|
||||
|
||||
if (accept) {
|
||||
comment.status !== 'ACCEPTED' && acceptComment({commentId: comment.id});
|
||||
} else {
|
||||
comment.status !== 'REJECTED' && rejectComment({commentId: comment.id});
|
||||
// Accept or reject only if there's a selected comment
|
||||
if(selectedCommentId != null){
|
||||
const comments = this.getComments();
|
||||
const commentIdx = comments.findIndex((comment) => comment.id === selectedCommentId);
|
||||
const comment = comments[commentIdx];
|
||||
|
||||
if (accept) {
|
||||
comment.status !== 'ACCEPTED' && acceptComment({commentId: comment.id});
|
||||
} else {
|
||||
comment.status !== 'REJECTED' && rejectComment({commentId: comment.id});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +167,8 @@ class Moderation extends Component {
|
||||
key.unbind('s');
|
||||
key.unbind('shift+/');
|
||||
key.unbind('esc');
|
||||
key.unbind('ctrl+f');
|
||||
key.unbind('t');
|
||||
key.unbind('j');
|
||||
key.unbind('k');
|
||||
key.unbind('f');
|
||||
|
||||
@@ -85,8 +85,8 @@ export class CommentForm extends React.Component {
|
||||
render() {
|
||||
const {maxCharCount, submitEnabled, cancelButtonClassName, submitButtonClassName, charCountEnable, body, loadingState} = this.props;
|
||||
|
||||
const length = body.length;
|
||||
const isRespectingMaxCount = (length) => charCountEnable && maxCharCount && length > maxCharCount;
|
||||
const length = body.trim().length;
|
||||
const isRespectingMaxCount = (length) => charCountEnable && maxCharCount && length > maxCharCount;
|
||||
const disableSubmitButton = !length || isRespectingMaxCount(length) || !submitEnabled({body}) || loadingState === 'loading';
|
||||
const disableCancelButton = loadingState === 'loading';
|
||||
const disableTextArea = loadingState === 'loading';
|
||||
|
||||
@@ -290,6 +290,8 @@ en:
|
||||
newest_first: "Newest First"
|
||||
navigation: Navigation
|
||||
next_comment: "Go to the next comment"
|
||||
toggle_search: "Open search"
|
||||
next_queue: "Switch queues"
|
||||
oldest_first: "Oldest First"
|
||||
premod: pre-mod
|
||||
prev_comment: "Go to the previous comment"
|
||||
|
||||
@@ -282,6 +282,8 @@ es:
|
||||
newest_first: "Primero el más nuevo"
|
||||
navigation: Navegación
|
||||
next_comment: "Ir al siguiente comentario"
|
||||
toggle_search: "Abrir búsqueda"
|
||||
next_queue: "Próxima cola"
|
||||
oldest_first: "Primero el más antiguo"
|
||||
premod: pre-mod
|
||||
prev_comment: "Ir al comentario anterior"
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styles from './styles.css';
|
||||
import {Button} from 'plugin-api/beta/client/components/ui';
|
||||
import {Button, TextField} from 'plugin-api/beta/client/components/ui';
|
||||
import t from 'coral-framework/services/i18n';
|
||||
|
||||
class ForgotContent extends React.Component {
|
||||
|
||||
state = {value: ''};
|
||||
|
||||
handleSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
this.props.fetchForgotPassword(this.emailInput.value);
|
||||
this.props.fetchForgotPassword(this.state.value);
|
||||
};
|
||||
|
||||
handleChangeEmail = (e) => {
|
||||
const {value} = e.target;
|
||||
this.setState({value});
|
||||
}
|
||||
|
||||
render() {
|
||||
const {changeView, auth} = this.props;
|
||||
const {passwordRequestSuccess, passwordRequestFailure} = auth;
|
||||
@@ -20,13 +29,14 @@ class ForgotContent extends React.Component {
|
||||
</div>
|
||||
<form onSubmit={this.handleSubmit}>
|
||||
<div className={styles.textField}>
|
||||
<label htmlFor="email">{t('sign_in.email')}</label>
|
||||
<input
|
||||
ref={(input) => (this.emailInput = input)}
|
||||
type="text"
|
||||
<TextField
|
||||
type="email"
|
||||
style={{fontSize: 16}}
|
||||
id="email"
|
||||
name="email"
|
||||
label={t('sign_in.email')}
|
||||
onChange={this.handleChangeEmail}
|
||||
value={this.state.value}
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
@@ -69,4 +79,10 @@ class ForgotContent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
ForgotContent.propTypes = {
|
||||
auth: PropTypes.object,
|
||||
changeView: PropTypes.func,
|
||||
fetchForgotPassword: PropTypes.func,
|
||||
};
|
||||
|
||||
export default ForgotContent;
|
||||
|
||||
Reference in New Issue
Block a user