mirror of
https://github.com/wassname/talk.git
synced 2026-07-03 19:32:30 +08:00
Allow setting default stream tab
This commit is contained in:
@@ -37,10 +37,18 @@ class Stream extends React.Component {
|
||||
this.setState({keepCommentBox: true});
|
||||
}
|
||||
|
||||
if (next.activeStreamTab !== 'all') {
|
||||
const slotPlugins = this.getSlotComponents('streamTabs', next).map((c) => c.talkPluginName);
|
||||
if (slotPlugins.indexOf(next.activeStreamTab) === -1) {
|
||||
next.setActiveStreamTab('all');
|
||||
this.fallbackAllTab(next);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.fallbackAllTab();
|
||||
}
|
||||
|
||||
fallbackAllTab(props = this.props) {
|
||||
if (props.activeStreamTab !== 'all') {
|
||||
const slotPlugins = this.getSlotComponents('streamTabs', props).map((c) => c.talkPluginName);
|
||||
if (slotPlugins.indexOf(props.activeStreamTab) === -1) {
|
||||
props.setActiveStreamTab('all');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ const initialState = {
|
||||
assetUrl: getQueryVariable('asset_url') || '',
|
||||
commentId: getQueryVariable('comment_id') || '',
|
||||
commentClassNames: [],
|
||||
activeTab: 'all',
|
||||
activeTab: process.env.TALK_DEFAULT_STEAM_TAB,
|
||||
previousTab: '',
|
||||
};
|
||||
|
||||
|
||||
+2
-1
@@ -109,7 +109,8 @@ const config = {
|
||||
}),
|
||||
new webpack.EnvironmentPlugin({
|
||||
'TALK_PLUGINS_JSON': '{}',
|
||||
'TALK_THREADING_LEVEL': '3'
|
||||
'TALK_THREADING_LEVEL': '3',
|
||||
'TALK_DEFAULT_STEAM_TAB': 'all',
|
||||
})
|
||||
],
|
||||
resolveLoader: {
|
||||
|
||||
Reference in New Issue
Block a user