Merge pull request #843 from rgarmsen2295/plt-138
PLT-138 Better parsing of the site's title when viewing a channel
Этот коммит содержится в:
@@ -43,7 +43,7 @@ export default class MoreDirectChannels extends React.Component {
|
|||||||
|
|
||||||
handleClick = function clickHandler(e) {
|
handleClick = function clickHandler(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
utils.switchChannel(channel, channel.teammate_username);
|
utils.switchChannel(channel);
|
||||||
$(React.findDOMNode(self.refs.modal)).modal('hide');
|
$(React.findDOMNode(self.refs.modal)).modal('hide');
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ export default class RenameChannelModal extends React.Component {
|
|||||||
$(React.findDOMNode(this.refs.modal)).modal('hide');
|
$(React.findDOMNode(this.refs.modal)).modal('hide');
|
||||||
|
|
||||||
AsyncClient.getChannel(channel.id);
|
AsyncClient.getChannel(channel.id);
|
||||||
Utils.updateTabTitle(channel.display_name);
|
|
||||||
Utils.updateAddressBar(channel.name);
|
Utils.updateAddressBar(channel.name);
|
||||||
|
|
||||||
React.findDOMNode(this.refs.displayName).value = '';
|
React.findDOMNode(this.refs.displayName).value = '';
|
||||||
|
|||||||
@@ -47,13 +47,8 @@ export default class SearchResultsItem extends React.Component {
|
|||||||
);
|
);
|
||||||
|
|
||||||
var postChannel = ChannelStore.get(this.props.post.channel_id);
|
var postChannel = ChannelStore.get(this.props.post.channel_id);
|
||||||
var teammate = '';
|
|
||||||
|
|
||||||
if (postChannel.type === 'D') {
|
utils.switchChannel(postChannel);
|
||||||
teammate = utils.getDirectTeammate(this.props.post.channel_id).username;
|
|
||||||
}
|
|
||||||
|
|
||||||
utils.switchChannel(postChannel, teammate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -268,14 +268,19 @@ export default class Sidebar extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateTitle() {
|
updateTitle() {
|
||||||
var channel = ChannelStore.getCurrent();
|
const channel = ChannelStore.getCurrent();
|
||||||
if (channel) {
|
if (channel) {
|
||||||
if (channel.type === 'D') {
|
let currentSiteName = '';
|
||||||
var teammateUsername = Utils.getDirectTeammate(channel.id).username;
|
if (global.window.config.SiteName != null) {
|
||||||
document.title = teammateUsername + ' ' + document.title.substring(document.title.lastIndexOf('-'));
|
currentSiteName = global.window.config.SiteName;
|
||||||
} else {
|
|
||||||
document.title = channel.display_name + ' ' + document.title.substring(document.title.lastIndexOf('-'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let currentChannelName = channel.display_name;
|
||||||
|
if (channel.type === 'D') {
|
||||||
|
currentChannelName = Utils.getDirectTeammate(channel.id).username;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.title = currentChannelName + ' - ' + this.props.teamDisplayName + ' ' + currentSiteName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onScroll() {
|
onScroll() {
|
||||||
|
|||||||
@@ -637,16 +637,12 @@ export function isValidUsername(name) {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateTabTitle(name) {
|
|
||||||
document.title = name + ' ' + document.title.substring(document.title.lastIndexOf('-'));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function updateAddressBar(channelName) {
|
export function updateAddressBar(channelName) {
|
||||||
var teamURL = window.location.href.split('/channels')[0];
|
var teamURL = window.location.href.split('/channels')[0];
|
||||||
history.replaceState('data', '', teamURL + '/channels/' + channelName);
|
history.replaceState('data', '', teamURL + '/channels/' + channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function switchChannel(channel, teammateName) {
|
export function switchChannel(channel) {
|
||||||
AppDispatcher.handleViewAction({
|
AppDispatcher.handleViewAction({
|
||||||
type: ActionTypes.CLICK_CHANNEL,
|
type: ActionTypes.CLICK_CHANNEL,
|
||||||
name: channel.name,
|
name: channel.name,
|
||||||
@@ -655,12 +651,6 @@ export function switchChannel(channel, teammateName) {
|
|||||||
|
|
||||||
updateAddressBar(channel.name);
|
updateAddressBar(channel.name);
|
||||||
|
|
||||||
if (channel.type === 'D' && teammateName) {
|
|
||||||
updateTabTitle(teammateName);
|
|
||||||
} else {
|
|
||||||
updateTabTitle(channel.display_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
AsyncClient.getChannels(true, true, true);
|
AsyncClient.getChannels(true, true, true);
|
||||||
AsyncClient.getChannelExtraInfo(true);
|
AsyncClient.getChannelExtraInfo(true);
|
||||||
AsyncClient.getPosts(channel.id);
|
AsyncClient.getPosts(channel.id);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user