Merge branch 'master' of https://github.com/mattermost/platform into plt-366
Этот коммит содержится в:
@@ -459,7 +459,13 @@ func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request)
|
|||||||
props := make(map[string]string)
|
props := make(map[string]string)
|
||||||
props["Message"] = err.Message
|
props["Message"] = err.Message
|
||||||
props["Details"] = err.DetailedError
|
props["Details"] = err.DetailedError
|
||||||
props["SiteURL"] = GetProtocol(r) + "://" + r.Host
|
|
||||||
|
pathParts := strings.Split(r.URL.Path, "/")
|
||||||
|
if len(pathParts) > 1 {
|
||||||
|
props["SiteURL"] = GetProtocol(r) + "://" + r.Host + "/" + pathParts[1]
|
||||||
|
} else {
|
||||||
|
props["SiteURL"] = GetProtocol(r) + "://" + r.Host
|
||||||
|
}
|
||||||
|
|
||||||
w.WriteHeader(err.StatusCode)
|
w.WriteHeader(err.StatusCode)
|
||||||
ServerTemplates.ExecuteTemplate(w, "error.html", Page{Props: props, ClientProps: utils.ClientProperties})
|
ServerTemplates.ExecuteTemplate(w, "error.html", Page{Props: props, ClientProps: utils.ClientProperties})
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ export default class CreateComment extends React.Component {
|
|||||||
submitting: false
|
submitting: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
componentDidUpdate(prevProps, prevState) {
|
||||||
|
if (prevState.uploadsInProgress < this.state.uploadsInProgress) {
|
||||||
|
$('.post-right__scroll').scrollTop($('.post-right__scroll')[0].scrollHeight);
|
||||||
|
$('.post-right__scroll').perfectScrollbar('update');
|
||||||
|
}
|
||||||
|
}
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ export default class CreatePost extends React.Component {
|
|||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
if (prevState.previews.length !== this.state.previews.length) {
|
if (prevState.previews.length !== this.state.previews.length) {
|
||||||
this.resizePostHolder();
|
this.resizePostHolder();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prevState.uploadsInProgress !== this.state.uploadsInProgress) {
|
||||||
|
this.resizePostHolder();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getCurrentDraft() {
|
getCurrentDraft() {
|
||||||
@@ -79,7 +85,7 @@ export default class CreatePost extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let post = {};
|
const post = {};
|
||||||
post.filenames = [];
|
post.filenames = [];
|
||||||
post.message = this.state.messageText;
|
post.message = this.state.messageText;
|
||||||
|
|
||||||
@@ -99,20 +105,20 @@ export default class CreatePost extends React.Component {
|
|||||||
this.state.channelId,
|
this.state.channelId,
|
||||||
post.message,
|
post.message,
|
||||||
false,
|
false,
|
||||||
function handleCommandSuccess(data) {
|
(data) => {
|
||||||
PostStore.storeDraft(data.channel_id, null);
|
PostStore.storeDraft(data.channel_id, null);
|
||||||
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
|
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
|
||||||
|
|
||||||
if (data.goto_location.length > 0) {
|
if (data.goto_location.length > 0) {
|
||||||
window.location.href = data.goto_location;
|
window.location.href = data.goto_location;
|
||||||
}
|
}
|
||||||
}.bind(this),
|
},
|
||||||
function handleCommandError(err) {
|
(err) => {
|
||||||
let state = {};
|
const state = {};
|
||||||
state.serverError = err.message;
|
state.serverError = err.message;
|
||||||
state.submitting = false;
|
state.submitting = false;
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
}.bind(this)
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
post.channel_id = this.state.channelId;
|
post.channel_id = this.state.channelId;
|
||||||
@@ -133,10 +139,10 @@ export default class CreatePost extends React.Component {
|
|||||||
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
|
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
|
||||||
|
|
||||||
Client.createPost(post, channel,
|
Client.createPost(post, channel,
|
||||||
function handlePostSuccess(data) {
|
(data) => {
|
||||||
AsyncClient.getPosts();
|
AsyncClient.getPosts();
|
||||||
|
|
||||||
let member = ChannelStore.getMember(channel.id);
|
const member = ChannelStore.getMember(channel.id);
|
||||||
member.msg_count = channel.total_msg_count;
|
member.msg_count = channel.total_msg_count;
|
||||||
member.last_viewed_at = Date.now();
|
member.last_viewed_at = Date.now();
|
||||||
ChannelStore.setChannelMember(member);
|
ChannelStore.setChannelMember(member);
|
||||||
@@ -146,8 +152,8 @@ export default class CreatePost extends React.Component {
|
|||||||
post: data
|
post: data
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function handlePostError(err) {
|
(err) => {
|
||||||
let state = {};
|
const state = {};
|
||||||
|
|
||||||
if (err.message === 'Invalid RootId parameter') {
|
if (err.message === 'Invalid RootId parameter') {
|
||||||
if ($('#post_deleted').length > 0) {
|
if ($('#post_deleted').length > 0) {
|
||||||
@@ -161,7 +167,7 @@ export default class CreatePost extends React.Component {
|
|||||||
|
|
||||||
state.submitting = false;
|
state.submitting = false;
|
||||||
this.setState(state);
|
this.setState(state);
|
||||||
}.bind(this)
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,9 +185,9 @@ export default class CreatePost extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleUserInput(messageText) {
|
handleUserInput(messageText) {
|
||||||
this.setState({messageText: messageText});
|
this.setState({messageText});
|
||||||
|
|
||||||
let draft = PostStore.getCurrentDraft();
|
const draft = PostStore.getCurrentDraft();
|
||||||
draft.message = messageText;
|
draft.message = messageText;
|
||||||
PostStore.storeCurrentDraft(draft);
|
PostStore.storeCurrentDraft(draft);
|
||||||
}
|
}
|
||||||
@@ -191,7 +197,7 @@ export default class CreatePost extends React.Component {
|
|||||||
$(window).trigger('resize');
|
$(window).trigger('resize');
|
||||||
}
|
}
|
||||||
handleUploadStart(clientIds, channelId) {
|
handleUploadStart(clientIds, channelId) {
|
||||||
let draft = PostStore.getDraft(channelId);
|
const draft = PostStore.getDraft(channelId);
|
||||||
|
|
||||||
draft.uploadsInProgress = draft.uploadsInProgress.concat(clientIds);
|
draft.uploadsInProgress = draft.uploadsInProgress.concat(clientIds);
|
||||||
PostStore.storeDraft(channelId, draft);
|
PostStore.storeDraft(channelId, draft);
|
||||||
@@ -199,7 +205,7 @@ export default class CreatePost extends React.Component {
|
|||||||
this.setState({uploadsInProgress: draft.uploadsInProgress});
|
this.setState({uploadsInProgress: draft.uploadsInProgress});
|
||||||
}
|
}
|
||||||
handleFileUploadComplete(filenames, clientIds, channelId) {
|
handleFileUploadComplete(filenames, clientIds, channelId) {
|
||||||
let draft = PostStore.getDraft(channelId);
|
const draft = PostStore.getDraft(channelId);
|
||||||
|
|
||||||
// remove each finished file from uploads
|
// remove each finished file from uploads
|
||||||
for (let i = 0; i < clientIds.length; i++) {
|
for (let i = 0; i < clientIds.length; i++) {
|
||||||
@@ -217,7 +223,7 @@ export default class CreatePost extends React.Component {
|
|||||||
}
|
}
|
||||||
handleUploadError(err, clientId) {
|
handleUploadError(err, clientId) {
|
||||||
if (clientId !== -1) {
|
if (clientId !== -1) {
|
||||||
let draft = PostStore.getDraft(this.state.channelId);
|
const draft = PostStore.getDraft(this.state.channelId);
|
||||||
|
|
||||||
const index = draft.uploadsInProgress.indexOf(clientId);
|
const index = draft.uploadsInProgress.indexOf(clientId);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
@@ -237,8 +243,8 @@ export default class CreatePost extends React.Component {
|
|||||||
Utils.setCaretPosition(React.findDOMNode(this.refs.textbox.refs.message), newText.length);
|
Utils.setCaretPosition(React.findDOMNode(this.refs.textbox.refs.message), newText.length);
|
||||||
}
|
}
|
||||||
removePreview(id) {
|
removePreview(id) {
|
||||||
let previews = this.state.previews;
|
const previews = Object.assign([], this.state.previews);
|
||||||
let uploadsInProgress = this.state.uploadsInProgress;
|
const uploadsInProgress = this.state.uploadsInProgress;
|
||||||
|
|
||||||
// id can either be the path of an uploaded file or the client id of an in progress upload
|
// id can either be the path of an uploaded file or the client id of an in progress upload
|
||||||
let index = previews.indexOf(id);
|
let index = previews.indexOf(id);
|
||||||
@@ -253,12 +259,12 @@ export default class CreatePost extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let draft = PostStore.getCurrentDraft();
|
const draft = PostStore.getCurrentDraft();
|
||||||
draft.previews = previews;
|
draft.previews = previews;
|
||||||
draft.uploadsInProgress = uploadsInProgress;
|
draft.uploadsInProgress = uploadsInProgress;
|
||||||
PostStore.storeCurrentDraft(draft);
|
PostStore.storeCurrentDraft(draft);
|
||||||
|
|
||||||
this.setState({previews: previews, uploadsInProgress: uploadsInProgress});
|
this.setState({previews, uploadsInProgress});
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
ChannelStore.addChangeListener(this.onChange);
|
ChannelStore.addChangeListener(this.onChange);
|
||||||
@@ -272,7 +278,7 @@ export default class CreatePost extends React.Component {
|
|||||||
if (this.state.channelId !== channelId) {
|
if (this.state.channelId !== channelId) {
|
||||||
const draft = this.getCurrentDraft();
|
const draft = this.getCurrentDraft();
|
||||||
|
|
||||||
this.setState({channelId: channelId, messageText: draft.messageText, initialText: draft.messageText, submitting: false, serverError: null, postError: null, previews: draft.previews, uploadsInProgress: draft.uploadsInProgress});
|
this.setState({channelId, messageText: draft.messageText, initialText: draft.messageText, submitting: false, serverError: null, postError: null, previews: draft.previews, uploadsInProgress: draft.uploadsInProgress});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getFileCount(channelId) {
|
getFileCount(channelId) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
const Client = require('../utils/client.jsx');
|
const Client = require('../utils/client.jsx');
|
||||||
const AsyncClient = require('../utils/async_client.jsx');
|
const AsyncClient = require('../utils/async_client.jsx');
|
||||||
const ChannelStore = require('../stores/channel_store.jsx');
|
const ChannelStore = require('../stores/channel_store.jsx');
|
||||||
|
var TeamStore = require('../stores/team_store.jsx');
|
||||||
|
|
||||||
export default class DeleteChannelModal extends React.Component {
|
export default class DeleteChannelModal extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -24,7 +25,7 @@ export default class DeleteChannelModal extends React.Component {
|
|||||||
Client.deleteChannel(this.state.channelId,
|
Client.deleteChannel(this.state.channelId,
|
||||||
function handleDeleteSuccess() {
|
function handleDeleteSuccess() {
|
||||||
AsyncClient.getChannels(true);
|
AsyncClient.getChannels(true);
|
||||||
window.location.href = '/';
|
window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/town-square';
|
||||||
},
|
},
|
||||||
function handleDeleteError(err) {
|
function handleDeleteError(err) {
|
||||||
AsyncClient.dispatchError(err, 'handleDelete');
|
AsyncClient.dispatchError(err, 'handleDelete');
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ export default class Navbar extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div className='navbar-brand'>
|
<div className='navbar-brand'>
|
||||||
<a
|
<a
|
||||||
href='/'
|
href={TeamStore.getCurrentTeamUrl() + '/channels/town-square'}
|
||||||
className='heading'
|
className='heading'
|
||||||
>
|
>
|
||||||
{channelTitle}
|
{channelTitle}
|
||||||
|
|||||||
@@ -105,18 +105,18 @@ export default class PostList extends React.Component {
|
|||||||
UserStore.addStatusesChangeListener(this.onTimeChange);
|
UserStore.addStatusesChangeListener(this.onTimeChange);
|
||||||
SocketStore.addChangeListener(this.onSocketChange);
|
SocketStore.addChangeListener(this.onSocketChange);
|
||||||
|
|
||||||
var postHolder = $(React.findDOMNode(this.refs.postlist));
|
const postHolder = $(React.findDOMNode(this.refs.postlist));
|
||||||
|
|
||||||
$(window).on('resize.' + this.props.channelId, function resize() {
|
$(window).resize(() => {
|
||||||
this.resize();
|
this.resize();
|
||||||
if (!this.scrolled) {
|
if (!this.scrolled) {
|
||||||
this.scrollToBottom();
|
this.scrollToBottom();
|
||||||
}
|
}
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
postHolder.on('scroll', function scroll() {
|
postHolder.on('scroll', () => {
|
||||||
var position = postHolder.scrollTop() + postHolder.height() + 14;
|
const position = postHolder.scrollTop() + postHolder.height() + 14;
|
||||||
var bottom = postHolder[0].scrollHeight;
|
const bottom = postHolder[0].scrollHeight;
|
||||||
|
|
||||||
if (position >= bottom) {
|
if (position >= bottom) {
|
||||||
this.scrolled = false;
|
this.scrolled = false;
|
||||||
@@ -128,7 +128,7 @@ export default class PostList extends React.Component {
|
|||||||
this.userHasSeenNew = true;
|
this.userHasSeenNew = true;
|
||||||
}
|
}
|
||||||
this.isUserScroll = true;
|
this.isUserScroll = true;
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
$('.post-list__content div .post').removeClass('post--last');
|
$('.post-list__content div .post').removeClass('post--last');
|
||||||
$('.post-list__content div:last-child .post').addClass('post--last');
|
$('.post-list__content div:last-child .post').addClass('post--last');
|
||||||
@@ -146,7 +146,7 @@ export default class PostList extends React.Component {
|
|||||||
UserStore.removeStatusesChangeListener(this.onTimeChange);
|
UserStore.removeStatusesChangeListener(this.onTimeChange);
|
||||||
SocketStore.removeChangeListener(this.onSocketChange);
|
SocketStore.removeChangeListener(this.onSocketChange);
|
||||||
$('body').off('click.userpopover');
|
$('body').off('click.userpopover');
|
||||||
$(window).off('resize.' + this.props.channelId);
|
$(window).off('resize');
|
||||||
var postHolder = $(React.findDOMNode(this.refs.postlist));
|
var postHolder = $(React.findDOMNode(this.refs.postlist));
|
||||||
postHolder.off('scroll');
|
postHolder.off('scroll');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export default class SSOSignUpPage extends React.Component {
|
|||||||
if (data.follow_link) {
|
if (data.follow_link) {
|
||||||
window.location.href = data.follow_link;
|
window.location.href = data.follow_link;
|
||||||
} else {
|
} else {
|
||||||
window.location.href = '/';
|
window.location.href = '/' + team.name + '/channels/town-square';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function fail(err) {
|
function fail(err) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||||
var ChannelStore = require('../stores/channel_store.jsx');
|
var ChannelStore = require('../stores/channel_store.jsx');
|
||||||
var UserStore = require('../stores/user_store.jsx');
|
var UserStore = require('../stores/user_store.jsx');
|
||||||
|
var TeamStore = require('../stores/team_store.jsx');
|
||||||
var Constants = require('../utils/constants.jsx');
|
var Constants = require('../utils/constants.jsx');
|
||||||
var ActionTypes = Constants.ActionTypes;
|
var ActionTypes = Constants.ActionTypes;
|
||||||
var AsyncClient = require('./async_client.jsx');
|
var AsyncClient = require('./async_client.jsx');
|
||||||
@@ -113,7 +114,7 @@ export function notifyMe(title, body, channel) {
|
|||||||
if (channel) {
|
if (channel) {
|
||||||
switchChannel(channel);
|
switchChannel(channel);
|
||||||
} else {
|
} else {
|
||||||
window.location.href = '/';
|
window.location.href = TeamStore.getCurrentTeamUrl() + '/channels/town-square';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setTimeout(function closeNotificationOnTimeout() {
|
setTimeout(function closeNotificationOnTimeout() {
|
||||||
|
|||||||
10
web/web.go
10
web/web.go
@@ -145,8 +145,14 @@ func root(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
page := NewHtmlTemplatePage("signup_team", "Signup")
|
if len(c.Session.UserId) == 0 {
|
||||||
page.Render(c, w)
|
page := NewHtmlTemplatePage("signup_team", "Signup")
|
||||||
|
page.Render(c, w)
|
||||||
|
} else {
|
||||||
|
page := NewHtmlTemplatePage("home", "Home")
|
||||||
|
page.Props["TeamURL"] = c.GetTeamURL()
|
||||||
|
page.Render(c, w)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func signup(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
func signup(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user