Merge branch 'dev' of lab.si.usi.ch:sa4-2020/the-sanmarinoes/frontend into 93-guests-implement-scenes-2

This commit is contained in:
Claudio Maggioni 2020-05-05 16:35:27 +02:00
commit 5c5988526b

View file

@ -11,7 +11,6 @@ import {
import { connect } from "react-redux"; import { connect } from "react-redux";
import { RemoteService, Forms } from "../remote"; import { RemoteService, Forms } from "../remote";
import { appActions } from "../storeActions"; import { appActions } from "../storeActions";
//import { update } from "immutability-helper";
class HostModal extends Component { class HostModal extends Component {
constructor(props) { constructor(props) {
@ -23,7 +22,8 @@ class HostModal extends Component {
.then(() => { .then(() => {
this.setState({ this.setState({
...this.state, ...this.state,
guests: this.props.guests.map((u) => u.id), guests: this.props.guests
.map((u) => u.id),
}); });
}) })
.catch(console.error); .catch(console.error);
@ -32,7 +32,7 @@ class HostModal extends Component {
.then((users) => .then((users) =>
this.setState({ this.setState({
...this.state, ...this.state,
users: users.map((u) => ({ users: users.filter(u => u.id !== this.props.currentUserId).map((u) => ({
key: u.id, key: u.id,
text: `@${u.username} (${u.name})`, text: `@${u.username} (${u.name})`,
value: u.id, value: u.id,
@ -127,6 +127,7 @@ const setActiveHost = (activeHost) => {
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
guests: state.guests, guests: state.guests,
currentUserId: state.userInfo.id
}); });
const HostModalContainer = connect( const HostModalContainer = connect(
mapStateToProps, mapStateToProps,