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