Merge branch 'release-4.0'
Этот коммит содержится в:
@@ -13,7 +13,7 @@ import {getProfilesByIds} from 'mattermost-redux/actions/users';
|
||||
import * as EmojiActions from 'mattermost-redux/actions/emojis';
|
||||
|
||||
export async function loadEmoji(getProfiles = true) {
|
||||
const data = await EmojiActions.getAllCustomEmojis(10000)(dispatch, getState);
|
||||
const data = await EmojiActions.getAllCustomEmojis()(dispatch, getState);
|
||||
|
||||
if (data && getProfiles) {
|
||||
loadProfilesForEmoji(data);
|
||||
|
||||
@@ -332,13 +332,6 @@ export function emitPreferencesDeletedEvent(preferences) {
|
||||
});
|
||||
}
|
||||
|
||||
export function emitRemovePost(post) {
|
||||
AppDispatcher.handleViewAction({
|
||||
type: Constants.ActionTypes.REMOVE_POST,
|
||||
post
|
||||
});
|
||||
}
|
||||
|
||||
export function sendEphemeralPost(message, channelId) {
|
||||
const timestamp = Utils.getTimestamp();
|
||||
const post = {
|
||||
@@ -497,6 +490,23 @@ export function toggleSideBarAction(visible) {
|
||||
}
|
||||
}
|
||||
|
||||
export function toggleSideBarRightMenuAction() {
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_SEARCH,
|
||||
results: null
|
||||
});
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_POST_SELECTED,
|
||||
postId: null
|
||||
});
|
||||
|
||||
document.querySelector('.app__body .inner-wrap').classList.remove('move--right', 'move--left', 'move--left-small');
|
||||
document.querySelector('.app__body .sidebar--left').classList.remove('move--right');
|
||||
document.querySelector('.app__body .sidebar--right').classList.remove('move--left');
|
||||
document.querySelector('.app__body .sidebar--menu').classList.remove('move--left');
|
||||
}
|
||||
|
||||
export function emitBrowserFocus(focus) {
|
||||
AppDispatcher.handleViewAction({
|
||||
type: ActionTypes.BROWSER_CHANGE_FOCUS,
|
||||
|
||||
@@ -14,12 +14,13 @@ import {sendDesktopNotification} from 'actions/notification_actions.jsx';
|
||||
import Constants from 'utils/constants.jsx';
|
||||
const ActionTypes = Constants.ActionTypes;
|
||||
|
||||
import {browserHistory} from 'react-router/es6';
|
||||
|
||||
// Redux actions
|
||||
import store from 'stores/redux_store.jsx';
|
||||
const dispatch = store.dispatch;
|
||||
const getState = store.getState;
|
||||
|
||||
import {getProfilesByIds} from 'mattermost-redux/actions/users';
|
||||
import * as PostActions from 'mattermost-redux/actions/posts';
|
||||
import {getMyChannelMember} from 'mattermost-redux/actions/channels';
|
||||
|
||||
@@ -55,7 +56,7 @@ function completePostReceive(post, websocketMessageProps) {
|
||||
PostActions.getPostThread(post.root_id)(dispatch, getState).then(
|
||||
(data) => {
|
||||
dispatchPostActions(post, websocketMessageProps);
|
||||
loadProfilesForPosts(data.posts);
|
||||
PostActions.getProfilesAndStatusesForPosts(data.posts, dispatch, getState);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -123,7 +124,7 @@ export function getFlaggedPosts() {
|
||||
is_pinned_posts: false
|
||||
});
|
||||
|
||||
loadProfilesForPosts(data.posts);
|
||||
PostActions.getProfilesAndStatusesForPosts(data.posts, dispatch, getState);
|
||||
}
|
||||
).catch(
|
||||
() => {} //eslint-disable-line no-empty-function
|
||||
@@ -147,34 +148,13 @@ export function getPinnedPosts(channelId = ChannelStore.getCurrentId()) {
|
||||
is_pinned_posts: true
|
||||
});
|
||||
|
||||
loadProfilesForPosts(data.posts);
|
||||
PostActions.getProfilesAndStatusesForPosts(data.posts, dispatch, getState);
|
||||
}
|
||||
).catch(
|
||||
() => {} //eslint-disable-line no-empty-function
|
||||
);
|
||||
}
|
||||
|
||||
export function loadProfilesForPosts(posts) {
|
||||
const profilesToLoad = {};
|
||||
for (const pid in posts) {
|
||||
if (!posts.hasOwnProperty(pid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const post = posts[pid];
|
||||
if (!UserStore.hasProfile(post.user_id)) {
|
||||
profilesToLoad[post.user_id] = true;
|
||||
}
|
||||
}
|
||||
|
||||
const list = Object.keys(profilesToLoad);
|
||||
if (list.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
getProfilesByIds(list)(dispatch, getState);
|
||||
}
|
||||
|
||||
export function addReaction(channelId, postId, emojiName) {
|
||||
PostActions.addReaction(postId, emojiName)(dispatch, getState);
|
||||
}
|
||||
@@ -202,6 +182,13 @@ export function updatePost(post, success) {
|
||||
(data) => {
|
||||
if (data && success) {
|
||||
success();
|
||||
} else {
|
||||
const serverError = getState().requests.posts.editPost.error;
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_ERROR,
|
||||
err: {id: serverError.server_error_id, ...serverError},
|
||||
method: 'editPost'
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -236,6 +223,18 @@ export function deletePost(channelId, post, success) {
|
||||
data: post
|
||||
});
|
||||
|
||||
// Needed for search store
|
||||
AppDispatcher.handleViewAction({
|
||||
type: Constants.ActionTypes.REMOVE_POST,
|
||||
post
|
||||
});
|
||||
|
||||
const {focusedPostId} = getState().views.channel;
|
||||
const channel = getState().entities.channels.channels[post.channel_id];
|
||||
if (post.id === focusedPostId && channel) {
|
||||
browserHistory.push(TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + channel.name);
|
||||
}
|
||||
|
||||
if (success) {
|
||||
success();
|
||||
}
|
||||
@@ -252,7 +251,7 @@ export function performSearch(terms, isMentionSearch, success, error) {
|
||||
is_mention_search: isMentionSearch
|
||||
});
|
||||
|
||||
loadProfilesForPosts(data.posts);
|
||||
PostActions.getProfilesAndStatusesForPosts(data.posts, dispatch, getState);
|
||||
|
||||
if (success) {
|
||||
success(data);
|
||||
@@ -321,3 +320,23 @@ export function searchForTerm(term) {
|
||||
do_search: true
|
||||
});
|
||||
}
|
||||
|
||||
export function pinPost(postId) {
|
||||
return async (doDispatch, doGetState) => {
|
||||
await PostActions.pinPost(postId)(doDispatch, doGetState);
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_POST_PINNED
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function unpinPost(postId) {
|
||||
return async (doDispatch, doGetState) => {
|
||||
await PostActions.unpinPost(postId)(doDispatch, doGetState);
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_POST_UNPINNED
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,16 +54,9 @@ export function loadStatusesForChannelAndSidebar() {
|
||||
const statusesToLoad = {};
|
||||
|
||||
const channelId = ChannelStore.getCurrentId();
|
||||
const postList = PostStore.getVisiblePosts(channelId);
|
||||
if (postList && postList.posts) {
|
||||
for (const pid in postList.posts) {
|
||||
if (!postList.posts.hasOwnProperty(pid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const post = postList.posts[pid];
|
||||
statusesToLoad[post.user_id] = true;
|
||||
}
|
||||
const posts = PostStore.getVisiblePosts(channelId) || [];
|
||||
for (const post of posts) {
|
||||
statusesToLoad[post.user_id] = true;
|
||||
}
|
||||
|
||||
const dmPrefs = PreferenceStore.getCategory(Preferences.CATEGORY_DIRECT_CHANNEL_SHOW);
|
||||
@@ -74,6 +67,9 @@ export function loadStatusesForChannelAndSidebar() {
|
||||
}
|
||||
}
|
||||
|
||||
const {currentUserId} = getState().entities.users;
|
||||
statusesToLoad[currentUserId] = true;
|
||||
|
||||
loadStatusesByIds(Object.keys(statusesToLoad));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// See License.txt for license information.
|
||||
|
||||
import $ from 'jquery';
|
||||
import AppDispatcher from 'dispatcher/app_dispatcher.jsx';
|
||||
|
||||
import UserStore from 'stores/user_store.jsx';
|
||||
import TeamStore from 'stores/team_store.jsx';
|
||||
@@ -15,7 +16,7 @@ import WebSocketClient from 'client/web_websocket_client.jsx';
|
||||
import * as WebrtcActions from './webrtc_actions.jsx';
|
||||
|
||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||
import {handleNewPost, loadProfilesForPosts} from 'actions/post_actions.jsx';
|
||||
import {handleNewPost} from 'actions/post_actions.jsx';
|
||||
import {loadProfilesForSidebar} from 'actions/user_actions.jsx';
|
||||
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
|
||||
import * as StatusActions from 'actions/status_actions.jsx';
|
||||
@@ -34,7 +35,7 @@ import {getSiteURL} from 'utils/url.jsx';
|
||||
|
||||
import * as TeamActions from 'mattermost-redux/actions/teams';
|
||||
import {viewChannel, getChannelAndMyMember, getChannelStats} from 'mattermost-redux/actions/channels';
|
||||
import {getPosts} from 'mattermost-redux/actions/posts';
|
||||
import {getPosts, getProfilesAndStatusesForPosts} from 'mattermost-redux/actions/posts';
|
||||
import {setServerVersion} from 'mattermost-redux/actions/general';
|
||||
import {ChannelTypes, TeamTypes, UserTypes, PostTypes, EmojiTypes} from 'mattermost-redux/action_types';
|
||||
|
||||
@@ -242,9 +243,7 @@ function handleNewPostEvent(msg) {
|
||||
const post = JSON.parse(msg.data.post);
|
||||
handleNewPost(post, msg);
|
||||
|
||||
const posts = {};
|
||||
posts[post.id] = post;
|
||||
loadProfilesForPosts(posts);
|
||||
getProfilesAndStatusesForPosts([post], dispatch, getState);
|
||||
|
||||
if (post.user_id !== UserStore.getCurrentId()) {
|
||||
UserStore.setStatus(post.user_id, UserStatuses.ONLINE);
|
||||
@@ -267,6 +266,12 @@ function handlePostEditEvent(msg) {
|
||||
function handlePostDeleteEvent(msg) {
|
||||
const post = JSON.parse(msg.data.post);
|
||||
dispatch({type: PostTypes.POST_DELETED, data: post});
|
||||
|
||||
// Needed for search store
|
||||
AppDispatcher.handleViewAction({
|
||||
type: Constants.ActionTypes.POST_DELETED,
|
||||
post
|
||||
});
|
||||
}
|
||||
|
||||
async function handleTeamAddedEvent(msg) {
|
||||
|
||||
Ссылка в новой задаче
Block a user