summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-11-04 14:31:15 -0400
committerGitHub <noreply@github.com>2016-11-04 14:31:15 -0400
commitb37eb09c37f5580e08ebdc2ae3a9c5ce09463230 (patch)
tree1e91d40b5f75d5fe9af036310e21bdf159a04f36 /webapp
parentec7f3ceee8b105036ea14550d102a6a1fa14cf82 (diff)
downloadchat-b37eb09c37f5580e08ebdc2ae3a9c5ce09463230.tar.gz
chat-b37eb09c37f5580e08ebdc2ae3a9c5ce09463230.tar.bz2
chat-b37eb09c37f5580e08ebdc2ae3a9c5ce09463230.zip
Removing ALT-click beacuse bug was not fixed (#4454)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/actions/post_actions.jsx58
-rw-r--r--webapp/components/post_view/components/post.jsx10
2 files changed, 1 insertions, 67 deletions
diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx
index 1a2056a2e..c2cc211b7 100644
--- a/webapp/actions/post_actions.jsx
+++ b/webapp/actions/post_actions.jsx
@@ -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');
}
diff --git a/webapp/components/post_view/components/post.jsx b/webapp/components/post_view/components/post.jsx
index 870d4e1af..823cb8ce7 100644
--- a/webapp/components/post_view/components/post.jsx
+++ b/webapp/components/post_view/components/post.jsx
@@ -4,7 +4,6 @@
import PostHeader from './post_header.jsx';
import PostBody from './post_body.jsx';
import ProfilePicture from 'components/profile_picture.jsx';
-import * as PostActions from 'actions/post_actions.jsx';
import Constants from 'utils/constants.jsx';
const ActionTypes = Constants.ActionTypes;
@@ -22,7 +21,6 @@ export default class Post extends React.Component {
this.handleCommentClick = this.handleCommentClick.bind(this);
this.handleDropdownOpened = this.handleDropdownOpened.bind(this);
this.forceUpdateInfo = this.forceUpdateInfo.bind(this);
- this.handlePostClick = this.handlePostClick.bind(this);
this.state = {
dropdownOpened: false
@@ -50,12 +48,7 @@ export default class Post extends React.Component {
this.refs.info.forceUpdate();
this.refs.header.forceUpdate();
}
- handlePostClick(e) {
- if (e.altKey) {
- e.preventDefault();
- PostActions.setUnreadPost(this.props.post.channel_id, this.props.post.id);
- }
- }
+
shouldComponentUpdate(nextProps, nextState) {
if (!Utils.areObjectsEqual(nextProps.post, this.props.post)) {
return true;
@@ -238,7 +231,6 @@ export default class Post extends React.Component {
<div
id={'post_' + post.id}
className={'post ' + sameUserClass + ' ' + compactClass + ' ' + rootUser + ' ' + postType + ' ' + currentUserCss + ' ' + shouldHighlightClass + ' ' + systemMessageClass + ' ' + hideControls + ' ' + dropdownOpenedClass}
- onClick={this.handlePostClick}
>
<div className={'post__content ' + centerClass}>
{profilePicContainer}