Merge branch 'next' into fix-set-username

This commit is contained in:
Kiwi
2018-01-09 15:07:56 +01:00
committed by GitHub
9 changed files with 70 additions and 70 deletions
+2 -3
View File
@@ -3,7 +3,6 @@ const CommentModel = require('../../../models/comment');
const ActionsService = require('../../../services/actions');
const {arrayJoinBy} = require('../../../graph/loaders/util');
const {get} = require('lodash');
const sc = require('snake-case');
const debug = require('debug')('talk:cli:verify');
const MODELS = [
@@ -38,8 +37,8 @@ async function processBatch(Model, documents) {
}
// And we generate the group id.
const ACTION_TYPE = sc(actionSummary.action_type.toLowerCase());
const GROUP_ID = sc(actionSummary.group_id.toLowerCase());
const ACTION_TYPE = actionSummary.action_type.toLowerCase();
const GROUP_ID = actionSummary.group_id.toLowerCase();
if (GROUP_ID.length <= 0) {
continue;
@@ -5,6 +5,11 @@ import {notify} from 'coral-framework/actions/notification';
import t from 'coral-framework/services/i18n';
import get from 'lodash/get';
export const updateStatus = (status) => ({
type: actions.UPDATE_STATUS,
status,
});
export const showSignInDialog = () => ({
type: actions.SHOW_SIGNIN_DIALOG,
});
@@ -54,3 +54,4 @@ export const SET_REQUIRE_EMAIL_VERIFICATION = 'SET_REQUIRE_EMAIL_VERIFICATION';
export const SET_REDIRECT_URI = 'SET_REDIRECT_URI';
export const RESET_SIGNIN_DIALOG = 'RESET_SIGNIN_DIALOG';
export const UPDATE_STATUS = 'UPDATE_STATUS';
@@ -21,7 +21,14 @@ import t from 'coral-framework/services/i18n';
import PropTypes from 'prop-types';
import {setActiveTab} from '../actions/embed';
const {logout, checkLogin, focusSignInDialog, blurSignInDialog, hideSignInDialog} = authActions;
const {
logout,
checkLogin,
focusSignInDialog,
blurSignInDialog,
hideSignInDialog,
updateStatus,
} = authActions;
const {fetchAssetSuccess} = assetActions;
class EmbedContainer extends React.Component {
@@ -35,20 +42,23 @@ class EmbedContainer extends React.Component {
if (props.auth.loggedIn) {
const newSubscriptions = [{
document: USER_BANNED_SUBSCRIPTION,
updateQuery: () => {
updateQuery: (_, {subscriptionData: {data: {userBanned: {state}}}}) => {
notify('info', t('your_account_has_been_banned'));
props.updateStatus(state.status);
},
},
{
document: USER_SUSPENDED_SUBSCRIPTION,
updateQuery: () => {
updateQuery: (_, {subscriptionData: {data: {userSuspended: {state}}}}) => {
notify('info', t('your_account_has_been_suspended'));
props.updateStatus(state.status);
},
},
{
document: USERNAME_REJECTED_SUBSCRIPTION,
updateQuery: () => {
updateQuery: (_, {subscriptionData: {data: {usernameRejected: {state}}}}) => {
notify('info', t('your_username_has_been_rejected'));
props.updateStatus(state.status);
},
}];
@@ -260,6 +270,7 @@ const mapDispatchToProps = (dispatch) =>
focusSignInDialog,
blurSignInDialog,
hideSignInDialog,
updateStatus,
},
dispatch
);
+10 -32
View File
@@ -1,5 +1,6 @@
import * as actions from '../constants/auth';
import pym from 'coral-framework/services/pym';
import merge from 'lodash/merge';
const initialState = {
isLoading: false,
@@ -228,38 +229,15 @@ export default function auth (state = initialState, action) {
...state,
redirectUri: action.uri,
};
case 'APOLLO_SUBSCRIPTION_RESULT':
// @TODO: These don't work anymore because apollo store has been decoupled
if (action.operationName === 'UserBanned' && state.user.id === action.variables.user_id) {
return {
...state,
user: {
...state.user,
...action.result.data.userBanned,
},
};
}
if (action.operationName === 'UserSuspended' && state.user.id === action.variables.user_id) {
return {
...state,
user: {
...state.user,
...action.result.data.userSuspended,
},
};
}
if (action.operationName === 'UsernameRejected' && state.user.id === action.variables.user_id) {
return {
...state,
user: {
...state.user,
...action.result.data.usernameRejected,
},
};
}
return state;
case actions.UPDATE_STATUS: {
return {
...state,
user: {
...state.user,
status: merge({}, state.user.status, action.status),
},
};
}
default :
return state;
}
@@ -197,4 +197,4 @@ will see a message at the top of their streams stating this.
### Ban
When a commenter has been banned, they will see a message at the top of their
streams staging this.
streams stating this.
+19 -11
View File
@@ -54,21 +54,29 @@ module.exports = {
moderateNav: '.talk-admin-nav-moderate',
settingsButton: '.talk-admin-header-settings-button',
signOutButton: '.talk-admin-header-sign-out',
suspendUserDialog: '.talk-admin-suspend-user-dialog',
suspendUserDialogStep0: '.talk-admin-suspend-user-dialog-step-0',
suspendUserDialogStep1: '.talk-admin-suspend-user-dialog-step-1',
suspendUserConfirmButton: '.talk-admin-suspend-user-dialog-confirm',
supendUserSendButton: '.talk-admin-suspend-user-dialog-send',
usernameDialog: '.talk-admin-reject-username-dialog',
usernameDialogStep0: '.talk-admin-reject-username-dialog-step-0',
usernameDialogStep1: '.talk-admin-reject-username-dialog-step-1',
usernameDialogButtons: '.talk-admin-reject-username-dialog-buttons',
usernameDialogSuspend: '.talk-admin-reject-username-dialog-button-k',
usernameDialogSuspensionMessage: '.talk-admin-reject-username-dialog-suspension-message',
toast: '.toastify',
toastClose: '.toastify__close',
},
sections: {
suspendUserDialog: {
selector: '.talk-admin-suspend-user-dialog',
elements: {
step0: '.talk-admin-suspend-user-dialog-step-0',
step1: '.talk-admin-suspend-user-dialog-step-1',
confirmButton: '.talk-admin-suspend-user-dialog-confirm',
sendButton: '.talk-admin-suspend-user-dialog-send',
}
},
usernameDialog: {
selector: '.talk-admin-reject-username-dialog',
elements: {
step0: '.talk-admin-reject-username-dialog-step-0',
step1: '.talk-admin-reject-username-dialog-step-1',
buttons: '.talk-admin-reject-username-dialog-buttons',
suspend: '.talk-admin-reject-username-dialog-button-k',
suspensionMessage: '.talk-admin-reject-username-dialog-suspension-message',
}
},
moderate: {
selector: '.talk-admin-moderation-container',
elements: {
+9 -10
View File
@@ -63,18 +63,17 @@ module.exports = {
.click('@flaggedUserRejectButton');
},
'admin suspends the user': (client) => {
const adminPage = client.page.admin();
const community = client.page.admin().section.community;
const usernameDialog = client.page.admin().section.usernameDialog;
adminPage
.waitForElementVisible('@usernameDialog')
.waitForElementVisible('@usernameDialogButtons')
.waitForElementVisible('@usernameDialogStep0')
.waitForElementVisible('@usernameDialogSuspend')
.click('@usernameDialogSuspend')
.waitForElementVisible('@usernameDialogStep1')
.waitForElementVisible('@usernameDialogSuspend')
.click('@usernameDialogSuspend');
usernameDialog
.waitForElementVisible('@buttons')
.waitForElementVisible('@step0')
.waitForElementVisible('@suspend')
.click('@suspend')
.waitForElementVisible('@step1')
.waitForElementVisible('@suspend')
.click('@suspend');
community
.waitForElementNotPresent('@flaggedUser');
+8 -9
View File
@@ -83,7 +83,7 @@ module.exports = {
},
'admin suspends user': (client) => {
const adminPage = client.page.admin();
const {moderate, userDetailDrawer} = adminPage.section;
const {moderate, userDetailDrawer, suspendUserDialog} = adminPage.section;
adminPage
.navigate()
@@ -101,14 +101,13 @@ module.exports = {
.waitForElementVisible('@actionItemSuspendUser')
.click('@actionItemSuspendUser');
adminPage
.waitForElementVisible('@suspendUserDialog')
.waitForElementVisible('@suspendUserDialogStep0')
.waitForElementVisible('@suspendUserConfirmButton')
.click('@suspendUserConfirmButton')
.waitForElementVisible('@suspendUserDialogStep1')
.waitForElementVisible('@supendUserSendButton')
.click('@supendUserSendButton');
suspendUserDialog
.waitForElementVisible('@step0')
.waitForElementVisible('@confirmButton')
.click('@confirmButton')
.waitForElementVisible('@step1')
.waitForElementVisible('@sendButton')
.click('@sendButton');
adminPage
.waitForElementVisible('@toast')