Removing ALT-click beacuse bug was not fixed (#4454)

Этот коммит содержится в:
Christopher Speller
2016-11-04 14:31:15 -04:00
коммит произвёл GitHub
родитель ec7f3ceee8
Коммит b37eb09c37
3 изменённых файлов: 3 добавлений и 69 удалений

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

@@ -10,7 +10,6 @@ import UserStore from 'stores/user_store.jsx';
import {loadStatusesForChannel} from 'actions/status_actions.jsx';
import * as PostUtils from 'utils/post_utils.jsx';
import Client from 'client/web_client.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
@@ -72,63 +71,6 @@ export function handleNewPost(post, msg) {
});
}
export function setUnreadPost(channelId, postId) {
let lastViewed = 0;
let ownNewMessage = false;
const post = PostStore.getPost(channelId, postId);
const posts = PostStore.getVisiblePosts(channelId).posts;
const currentChannel = ChannelStore.getCurrent();
var currentUsedId = UserStore.getCurrentId();
if (currentUsedId === post.user_id || PostUtils.isSystemMessage(post)) {
for (const otherPostId in posts) {
if (lastViewed < posts[otherPostId].create_at && currentUsedId !== posts[otherPostId].user_id && !PostUtils.isSystemMessage(posts[otherPostId])) {
lastViewed = posts[otherPostId].create_at;
}
}
if (lastViewed === 0) {
lastViewed = Number.MAX_VALUE;
} else if (lastViewed > post.create_at) {
lastViewed = post.create_at - 1;
ownNewMessage = true;
} else {
lastViewed -= 1;
}
} else {
lastViewed = post.create_at - 1;
}
if (lastViewed === Number.MAX_VALUE) {
AsyncClient.updateLastViewedAt();
ChannelStore.resetCounts(ChannelStore.getCurrentId());
ChannelStore.emitChange();
} else {
let unreadPosts = 0;
for (const otherPostId in posts) {
if (posts[otherPostId].create_at > lastViewed) {
unreadPosts += 1;
}
}
// Temporary workaround for DM channels having wrong unread values
if (currentChannel.type === Constants.DM_CHANNEL) {
unreadPosts = 0;
}
const member = ChannelStore.getMember(channelId);
const channel = ChannelStore.get(channelId);
member.last_viewed_at = lastViewed;
member.msg_count = channel.total_msg_count - unreadPosts;
member.mention_count = 0;
ChannelStore.storeMyChannelMember(member);
ChannelStore.setUnreadCountByChannel(channelId);
AsyncClient.setLastViewedAt(lastViewed, channelId);
}
if (channelId === ChannelStore.getCurrentId()) {
ChannelStore.emitLastViewed(lastViewed, ownNewMessage);
}
}
export function flagPost(postId) {
AsyncClient.savePreference(Preferences.CATEGORY_FLAGGED_POST, postId, 'true');
}