PLT-567 auto join open channels
Этот коммит содержится в:
@@ -2,6 +2,7 @@
|
|||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
const TextFormatting = require('./text_formatting.jsx');
|
const TextFormatting = require('./text_formatting.jsx');
|
||||||
|
const Utils = require('./utils.jsx');
|
||||||
|
|
||||||
const marked = require('marked');
|
const marked = require('marked');
|
||||||
|
|
||||||
@@ -39,7 +40,14 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
|
|||||||
if (title) {
|
if (title) {
|
||||||
output += ' title="' + title + '"';
|
output += ' title="' + title + '"';
|
||||||
}
|
}
|
||||||
output += ' target="_blank">' + text + '</a>';
|
|
||||||
|
if (outHref.indexOf(Utils.getTeamURLFromAddressBar()) === 0) {
|
||||||
|
output += '>';
|
||||||
|
} else {
|
||||||
|
output += ' target="_blank">';
|
||||||
|
}
|
||||||
|
|
||||||
|
output += text + '</a>';
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|||||||
19
web/web.go
19
web/web.go
@@ -372,11 +372,22 @@ func getChannel(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//api.Handle404(w, r)
|
// We will attempt to auto-join open channels
|
||||||
//Bad channel urls just redirect to the town-square for now
|
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)
|
channelId = channel.Id
|
||||||
return
|
} else {
|
||||||
|
http.Redirect(w, r, c.GetTeamURL()+"/channels/town-square", http.StatusFound)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user