Этот коммит содержится в:
Gabin Aureche
2017-03-13 13:25:08 +01:00
коммит произвёл George Goldberg
родитель 482a0fb5fc
Коммит fe38d6d5bb
38 изменённых файлов: 885 добавлений и 52 удалений

Просмотреть файл

@@ -68,6 +68,14 @@ export function handleNewPost(post, msg) {
});
}
export function pinPost(channelId, postId) {
AsyncClient.pinPost(channelId, postId);
}
export function unpinPost(channelId, postId) {
AsyncClient.unpinPost(channelId, postId);
}
export function flagPost(postId) {
trackEvent('api', 'api_posts_flagged');
AsyncClient.savePreference(Preferences.CATEGORY_FLAGGED_POST, postId, 'true');
@@ -96,7 +104,8 @@ export function getFlaggedPosts() {
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_SEARCH,
results: data,
is_flagged_posts: true
is_flagged_posts: true,
is_pinned_posts: false
});
loadProfilesForPosts(data.posts);
@@ -107,6 +116,31 @@ export function getFlaggedPosts() {
);
}
export function getPinnedPosts(channelId) {
Client.getPinnedPosts(channelId,
(data) => {
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_SEARCH_TERM,
term: null,
do_search: false,
is_mention_search: false
});
AppDispatcher.handleServerAction({
type: ActionTypes.RECEIVED_SEARCH,
results: data,
is_flagged_posts: false,
is_pinned_posts: true
});
loadProfilesForPosts(data.posts);
},
(err) => {
AsyncClient.dispatchError(err, 'getPinnedPosts');
}
);
}
export function loadPosts(channelId = ChannelStore.getCurrentId(), isPost = false) {
const postList = PostStore.getAllPosts(channelId);
const latestPostTime = PostStore.getLatestPostFromPageTime(channelId);