Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfixes (fix #260 fix #241 fix #188 fix #233 fix #231 fix #119) #262

Merged
merged 8 commits into from
Sep 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"babel-runtime": "6.11.6",
"bcrypt": "^0.8.7",
"body-parser": "1.15.2",
"cashay": "^0.20.1",
"cashay": "^0.20.6",
"cheerio": "^0.20.0",
"compression": "1.6.2",
"cors": "2.7.1",
Expand Down
2 changes: 2 additions & 0 deletions src/universal/components/Dashboard/DashSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ styles = StyleSheet.create({
backgroundColor: theme.palette.mid,
color: textColor,
minWidth: layoutStyle.dashSidebarWidth,
maxWidth: layoutStyle.dashSidebarWidth,
paddingBottom: '1.25rem'
},

Expand All @@ -64,6 +65,7 @@ styles = StyleSheet.create({

navLabel: {
borderTop: '1px solid rgba(255, 255, 255, .5)',
cursor: 'default',
fontSize: theme.typography.s2,
fontWeight: 700,
marginLeft: '1rem',
Expand Down
5 changes: 1 addition & 4 deletions src/universal/components/NotificationBar/NotificationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ const NotificationBar = (props) => {


NotificationBar.propTypes = {
activeMeetings: PropTypes.arrayOf({
link: PropTypes.string,
name: PropTypes.string
})
activeMeetings: PropTypes.array
};

styles = StyleSheet.create({
Expand Down
2 changes: 2 additions & 0 deletions src/universal/containers/Logout/LogoutContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {removeAuthToken} from 'universal/redux/authDuck';
import {reset as resetAppState} from 'universal/redux/rootDuck';
import {withRouter} from 'react-router';
import {segmentEvent} from 'universal/redux/segmentActions';
import {cashay} from 'cashay';

const logoutSuccess = {
title: 'Tootles!',
Expand All @@ -28,6 +29,7 @@ export default class LogoutContainer extends Component {
dispatch(resetAppState());
dispatch(showSuccess(logoutSuccess));
dispatch(segmentEvent('User Logout'));
cashay.clear();
if (typeof window !== 'undefined' && typeof window.analytics !== 'undefined') {
// inform segment of the logout, wipe state:
window.analytics.reset();
Expand Down
8 changes: 5 additions & 3 deletions src/universal/containers/StandardHub/StandardHubContainer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React, {PropTypes} from 'react';
import {cashay} from 'cashay';
import {getAuthQueryString, authedOptions} from 'universal/redux/getAuthedUser';
import {getAuthQueryString, getAuthedOptions} from 'universal/redux/getAuthedUser';
import {connect} from 'react-redux';
import StandardHub from 'universal/components/StandardHub/StandardHub';

const mapStateToProps = () => {
const mapStateToProps = (state) => {
const userId = state.auth.obj.sub;
const {user} = cashay.query(getAuthQueryString, getAuthedOptions(userId)).data;
return {
user: cashay.query(getAuthQueryString, authedOptions).data.user
user
};
};

Expand Down
15 changes: 5 additions & 10 deletions src/universal/decorators/loginWithToken/loginWithToken.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import React, {PropTypes} from 'react';
import {getAuthQueryString, authedOptions} from 'universal/redux/getAuthedUser';
import {getAuthQueryString, getAuthedOptions} from 'universal/redux/getAuthedUser';
import {cashay} from 'cashay';
import {connect} from 'react-redux';
import {withRouter} from 'react-router';

const mapStateToProps = state => {
const auth = state.auth.obj;
return {
auth: state.auth.obj,
user: cashay.query(getAuthQueryString, authedOptions).data.user
user: cashay.query(getAuthQueryString, getAuthedOptions(auth.sub)).data.user
};
};

export default ComposedComponent => {
const TokenizedComp = (props) => {
const {auth, user, router} = props;
if (auth.sub && user) {
const {auth, router} = props;
if (auth.sub) {
// note if you join a team & leave it, tms will be an empty array
const isNew = !auth.hasOwnProperty('tms');
if (isNew) {
Expand All @@ -28,12 +29,6 @@ export default ComposedComponent => {

TokenizedComp.propTypes = {
auth: PropTypes.object,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, duh, this makes a lot of sense.

user: PropTypes.shape({
email: PropTypes.string,
id: PropTypes.string,
picture: PropTypes.string,
preferredName: PropTypes.string
}),
router: PropTypes.object.isRequired
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {Component, PropTypes} from 'react';
import {showError} from 'universal/modules/notifications/ducks/notifications';
import {getAuthQueryString, authedOptions} from 'universal/redux/getAuthedUser';
import {getAuthQueryString, getAuthedOptions} from 'universal/redux/getAuthedUser';
import {cashay} from 'cashay';
import {connect} from 'react-redux';
import {withRouter} from 'react-router';
Expand All @@ -16,10 +16,10 @@ const unauthenticated = {
};

const mapStateToProps = state => {
const user = cashay.query(getAuthQueryString, authedOptions).data.user;
const userId = state.auth.obj.sub;
return {
auth: state.auth.obj,
user
user: cashay.query(getAuthQueryString, getAuthedOptions(userId)).data.user
};
};

Expand Down
49 changes: 22 additions & 27 deletions src/universal/decorators/socketWithPresence/socketWithPresence.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,13 @@ import {reduxSocket} from 'redux-socket-cluster';
import {cashay} from 'cashay';
import requireAuth from 'universal/decorators/requireAuth/requireAuth';
import reduxSocketOptions from 'universal/redux/reduxSocketOptions';
import {PRESENCE} from 'universal/subscriptions/constants';
import {PRESENCE, TEAM_MEMBERS} from 'universal/subscriptions/constants';
import socketCluster from 'socketcluster-client';
import presenceSubscriber from 'universal/subscriptions/presenceSubscriber';


const presenceSubQuery = `
query {
presence(teamId: $teamId) @live {
id
userId
editing
}
}`;

const mapStateToProps = (state, props) => {
const {params: {teamId}} = props;
const mapStateToProps = (state) => {
return {
presence: cashay.query(presenceSubQuery, {
op: 'socketWithPresence',
key: teamId,
variables: {teamId},
subscriber: {presence: presenceSubscriber}
})
tms: state.auth.obj.tms
};
};

Expand All @@ -40,19 +24,30 @@ export default ComposedComponent => {
dispatch: PropTypes.func,
params: PropTypes.shape({
teamId: PropTypes.string
})
}),
tms: PropTypes.array
};

constructor(props) {
super(props);
const {params, tms} = props;
const teamIds = params.teamId ? [params.teamId] : tms;
if (!teamIds) {
throw new Error(`Did not finish the welcome wizard! ${params} ${tms}`);
// TODO redirect?
}
const socket = socketCluster.connect();
socket.on('subscribe', channelName => {
const {teamId} = props.params;
if (channelName === `${PRESENCE}/${teamId}`) {
const options = {variables: {teamId}};
cashay.mutate('soundOff', options);
}
});
for (let i = 0; i < teamIds.length; i++) {
const teamId = teamIds[i];
cashay.subscribe(PRESENCE, teamId, presenceSubscriber);
cashay.subscribe(TEAM_MEMBERS, teamId);
socket.on('subscribe', channelName => {
if (channelName === `${PRESENCE}/${teamId}`) {
const options = {variables: {teamId}};
cashay.mutate('soundOff', options);
}
});
}
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import LoadingView from 'universal/components/LoadingView/LoadingView';
import {withRouter} from 'react-router';
import {showError, showSuccess, showWarning} from 'universal/modules/notifications/ducks/notifications';
import {setAuthToken} from 'universal/redux/authDuck';
import {getAuthQueryString, authedOptions} from 'universal/redux/getAuthedUser';
import {getAuthQueryString, getAuthedOptions} from 'universal/redux/getAuthedUser';
import {setWelcomeActivity} from 'universal/modules/userDashboard/ducks/settingsDuck';
import jwtDecode from 'jwt-decode';
import {
Expand All @@ -18,10 +18,11 @@ import {

const mapStateToProps = (state, props) => {
const {params: {id}} = props;
const auth = state.auth.obj;
return {
auth: state.auth.obj,
auth,
inviteToken: id,
user: cashay.query(getAuthQueryString, authedOptions).data.user
user: cashay.query(getAuthQueryString, getAuthedOptions(auth.sub))
};
};

Expand Down
3 changes: 2 additions & 1 deletion src/universal/modules/meeting/components/Sidebar/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const Sidebar = (props) => {
<a className={s.brandLink} onClick={handleLogoClick}>
<img className={s.brandLogo} src={actionUIMark}/>
</a>
<div className={s.teamName}>{teamName}</div>
<Link className={s.teamName} to={`/team/${teamId}`}>{teamName}</Link>
<a className={s.shortUrl} href="/meetingLayout/lobby">{shortUrl}</a>
{/* TODO: make me respond to props */}
</div>
Expand Down Expand Up @@ -233,6 +233,7 @@ s = StyleSheet.create({

teamName: {
color: theme.palette.cool,
cursor: 'pointer',
fontFamily: theme.typography.serif,
fontSize: theme.typography.s5,
fontStyle: 'italic',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import {
} from 'universal/utils/constants';
import MeetingAgendaFirstCall from 'universal/modules/meeting/components/MeetingAgendaFirstCall/MeetingAgendaFirstCall';
import MeetingAgendaLastCallContainer from 'universal/modules/meeting/containers/MeetingAgendaLastCall/MeetingAgendaLastCallContainer';
import {TEAMS} from 'universal/subscriptions/constants';


const resolveMeetingMembers = (queryData, userId) => {
if (queryData !== resolveMeetingMembers.queryData) {
Expand Down Expand Up @@ -116,7 +118,7 @@ export default class MeetingContainer extends Component {
const {localPhaseItem, params, router, team} = props;
const {localPhase} = params;
// subscribe to all teams, but don't do anything with that open subscription
cashay.subscribe('teams');
cashay.subscribe(TEAMS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mucho mejor

handleRedirects(team, localPhase, localPhaseItem, router);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ s = StyleSheet.create({
},
':focus': {
backgroundColor: theme.palette.dark20l
},
':hover > div': {
opacity: 1
}
},

Expand All @@ -77,8 +80,10 @@ s = StyleSheet.create({
cursor: 'pointer',
left: '1.25rem',
// paddingTop: '1px',
opacity: 0,
position: 'absolute',
top: '.5rem'
top: '.5rem',
transition: 'opacity .1s ease-in'
},

desc: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let styles = {};
export default class OutcomeCardTextArea extends Component {
static propTypes = {
doFocus: PropTypes.bool,
editingStatus: PropTypes.string,
editingStatus: PropTypes.any,
handleActive: PropTypes.func,
handleSubmit: PropTypes.func,
input: PropTypes.object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const UserActionList = (props) => {
const {actions} = props;
return (
<div className={styles.root}>
{actions.map(item => <div key={`action${item.id}`}>{item.content}</div>)}
{actions.map(item => <div key={`action${item.id}`}>{item.content} - {item.updatedAt.toString()}</div>)}
</div>
);
};
Expand Down
Loading