Add pinned posts (#4217)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
482a0fb5fc
Коммит
fe38d6d5bb
@@ -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);
|
||||
|
||||
Ссылка в новой задаче
Block a user