summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/react/components/channel_header.jsx4
-rw-r--r--web/react/components/post_list.jsx8
-rw-r--r--web/react/components/removed_from_channel_modal.jsx8
-rw-r--r--web/react/components/sidebar.jsx2
-rw-r--r--web/react/utils/markdown.jsx10
-rw-r--r--web/react/utils/text_formatting.jsx7
-rw-r--r--web/web.go19
7 files changed, 40 insertions, 18 deletions
diff --git a/web/react/components/channel_header.jsx b/web/react/components/channel_header.jsx
index b39599d48..e47db073d 100644
--- a/web/react/components/channel_header.jsx
+++ b/web/react/components/channel_header.jsx
@@ -58,7 +58,9 @@ export default class ChannelHeader extends React.Component {
$('.channel-header__info .description').popover({placement: 'bottom', trigger: 'hover', html: true, delay: {show: 500, hide: 500}});
}
onSocketChange(msg) {
- if (msg.action === 'new_user') {
+ if (msg.action === 'new_user' ||
+ msg.action === 'user_added' ||
+ (msg.action === 'user_removed' && msg.user_id !== UserStore.getCurrentId())) {
AsyncClient.getChannelExtraInfo(true);
}
}
diff --git a/web/react/components/post_list.jsx b/web/react/components/post_list.jsx
index 5be58704b..643b38af5 100644
--- a/web/react/components/post_list.jsx
+++ b/web/react/components/post_list.jsx
@@ -379,13 +379,9 @@ export default class PostList extends React.Component {
<p className='channel-intro__content'>
Welcome to {channel.display_name}!
<br/><br/>
- This is the first channel teammates see when they
- <br/>
- sign up - use it for posting updates everyone needs to know.
+ This is the first channel teammates see when they sign up - use it for posting updates everyone needs to know.
<br/><br/>
- To create a new channel or join an existing one, go to
- <br/>
- the Left Hand Sidebar under “Channels” and click “More…”.
+ To create a new channel or join an existing one, go to the Left Sidebar under “Channels” and click “More…”.
<br/>
</p>
</div>
diff --git a/web/react/components/removed_from_channel_modal.jsx b/web/react/components/removed_from_channel_modal.jsx
index db930ce44..ca35d6fb0 100644
--- a/web/react/components/removed_from_channel_modal.jsx
+++ b/web/react/components/removed_from_channel_modal.jsx
@@ -26,13 +26,13 @@ export default class RemovedFromChannelModal extends React.Component {
BrowserStore.removeItem('channel-removed-state');
}
+ var townSquare = ChannelStore.getByName('town-square');
+ setTimeout(() => utils.switchChannel(townSquare), 1);
+
this.setState(newState);
}
handleClose() {
- var townSquare = ChannelStore.getByName('town-square');
- utils.switchChannel(townSquare);
-
this.setState({channelName: '', remover: ''});
}
@@ -98,4 +98,4 @@ export default class RemovedFromChannelModal extends React.Component {
return <div/>;
}
-} \ No newline at end of file
+}
diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index d8cf7f0d9..4ac1fd4a0 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -262,7 +262,7 @@ export default class Sidebar extends React.Component {
if (msg.user_id === UserStore.getCurrentId()) {
AsyncClient.getChannels(true);
- if (msg.props.channel_id === ChannelStore.getCurrentId() && $('#removed_from_channel').length > 0) {
+ if (msg.props.remover !== msg.user_id && msg.props.channel_id === ChannelStore.getCurrentId() && $('#removed_from_channel').length > 0) {
var sentState = {};
sentState.channelName = ChannelStore.getCurrent().display_name;
sentState.remover = UserStore.getProfile(msg.props.remover).username;
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx
index 70ae2480c..12d6dd424 100644
--- a/web/react/utils/markdown.jsx
+++ b/web/react/utils/markdown.jsx
@@ -2,6 +2,7 @@
// See License.txt for license information.
const TextFormatting = require('./text_formatting.jsx');
+const Utils = require('./utils.jsx');
const marked = require('marked');
@@ -39,7 +40,14 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
if (title) {
output += ' title="' + title + '"';
}
- output += ' target="_blank">' + text + '</a>';
+
+ if (outHref.lastIndexOf(Utils.getTeamURLFromAddressBar(), 0) === 0) {
+ output += '>';
+ } else {
+ output += ' target="_blank">';
+ }
+
+ output += text + '</a>';
return output;
}
diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx
index ccc01ce5c..a90a8bcc1 100644
--- a/web/react/utils/text_formatting.jsx
+++ b/web/react/utils/text_formatting.jsx
@@ -96,8 +96,13 @@ function autolinkUrls(text, tokens) {
const index = tokens.size;
const alias = `MM_LINK${index}`;
+ var target = 'target="_blank"';
+ if (url.lastIndexOf(Utils.getTeamURLFromAddressBar(), 0) === 0) {
+ target = '';
+ }
+
tokens.set(alias, {
- value: `<a class='theme' target='_blank' href='${url}'>${linkText}</a>`,
+ value: '<a class="theme"' + target + ' href="${url}">${linkText}</a>',
originalText: linkText
});
diff --git a/web/web.go b/web/web.go
index c03b5463a..7ab50a073 100644
--- a/web/web.go
+++ b/web/web.go
@@ -372,11 +372,22 @@ func getChannel(c *api.Context, w http.ResponseWriter, r *http.Request) {
return
}
- //api.Handle404(w, r)
- //Bad channel urls just redirect to the town-square for now
+ // We will attempt to auto-join open channels
+ if cr := <-api.Srv.Store.Channel().GetByName(c.Session.TeamId, name); cr.Err != nil {
+ http.Redirect(w, r, c.GetTeamURL()+"/channels/town-square", http.StatusFound)
+ } else {
+ channel := cr.Data.(*model.Channel)
+ if channel.Type == model.CHANNEL_OPEN {
+ api.JoinChannel(c, channel.Id, "")
+ if c.Err != nil {
+ return
+ }
- http.Redirect(w, r, c.GetTeamURL()+"/channels/town-square", http.StatusFound)
- return
+ channelId = channel.Id
+ } else {
+ http.Redirect(w, r, c.GetTeamURL()+"/channels/town-square", http.StatusFound)
+ }
+ }
}
}