From 747043bdcf3529a103881e00a07e91536de9a975 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Nov 02 2017 12:03:57 +0000 Subject: [PATCH 1/2] Better handling of unconfigured hubs --- diff --git a/hubs/static/client/app/widgets/irc/Widget.js b/hubs/static/client/app/widgets/irc/Widget.js index b397364..eac253c 100644 --- a/hubs/static/client/app/widgets/irc/Widget.js +++ b/hubs/static/client/app/widgets/irc/Widget.js @@ -8,17 +8,35 @@ import "./IRCWidget.css"; class IRCWidget extends React.Component { render() { + const domain = this.props.hub.config.chat_domain; + const channel = this.props.hub.config.chat_channel; + let content; + if (!domain || !channel) { + content = "No IRC channel configured."; + if (this.props.currentUser.can_config_hub) { + content += " Go to \"Hubs settings\" to configure it."; + } + content = ( +

+ {content} +

+ ); + } else { + content = ( + + ); + } return (
- + {content}
); @@ -34,6 +52,7 @@ IRCWidget.propTypes = { const mapStateToProps = (state) => { return { hub: state.entities.hub, + currentUser: state.currentUser, } }; From fe715c96e2dfbf3dbcbf3a56076a526bd8ff4383 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Nov 02 2017 12:03:57 +0000 Subject: [PATCH 2/2] Setup the IRC widget for group hubs by default --- diff --git a/hubs/defaults.py b/hubs/defaults.py index 5cf01f8..dcdc237 100644 --- a/hubs/defaults.py +++ b/hubs/defaults.py @@ -123,7 +123,19 @@ def add_group_widgets(session, hub, name, summary, ) hub.widgets.append(widget) - # TODO - set up irc widget with the right irc channel + # IRC + if irc_channel and irc_network: + hub.config.chat_domain = irc_network + hub.config.chat_channel = irc_channel + hub.widgets.append( + hubs.models.Widget( + plugin='irc', index=2, + _config=json.dumps({ + 'height': 450, + }) + ) + ) + # TODO - set up mailing list with the right mailing list. # TODO - set up feed with aggregate of users stuff unless we have some