Removing ALT-click beacuse bug was not fixed (#4454)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ec7f3ceee8
Коммит
b37eb09c37
@@ -629,11 +629,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "api.command_shortcuts.msgs",
|
"id": "api.command_shortcuts.msgs",
|
||||||
"translation": "#### Messages\n\nALT+[click on a message]: Set a message as your oldest unread message in the current channel\nESC: Mark all messages in the current channel as read\nCTRL+UP (in empty input field): Reprint the previous message or slash command you entered\nCTRL+DOWN (in empty input field): Reprint the next message or slash command you entered\nUP (in empty input field): Edit your last message in the current channel\n@[character]+TAB: Autocomplete @username beginning with [character]\n#[character]+TAB: Autocomplete channel beginning with [character]\n:[character]+TAB: Autocomplete emoji beginning with [character]\n\n"
|
"translation": "#### Messages\n\nESC: Mark all messages in the current channel as read\nCTRL+UP (in empty input field): Reprint the previous message or slash command you entered\nCTRL+DOWN (in empty input field): Reprint the next message or slash command you entered\nUP (in empty input field): Edit your last message in the current channel\n@[character]+TAB: Autocomplete @username beginning with [character]\n#[character]+TAB: Autocomplete channel beginning with [character]\n:[character]+TAB: Autocomplete emoji beginning with [character]\n\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "api.command_shortcuts.msgs_mac",
|
"id": "api.command_shortcuts.msgs_mac",
|
||||||
"translation": "#### Messages\n\nALT+[click on a message]: Set a message as your oldest unread message in the current channel\nESC: Mark all messages in the current channel as read\nCMD+UP (in empty input field): Reprint the previous message or slash command you entered\nCMD+DOWN (in empty input field): Reprint the next message or slash command you entered\nUP (in empty input field): Edit your last message in the current channel\n@[character]+TAB: Autocomplete @username beginning with [character]\n#[character]+TAB: Autocomplete channel beginning with [character]\n:[character]+TAB: Autocomplete emoji beginning with [character]\n\n"
|
"translation": "#### Messages\n\nESC: Mark all messages in the current channel as read\nCMD+UP (in empty input field): Reprint the previous message or slash command you entered\nCMD+DOWN (in empty input field): Reprint the next message or slash command you entered\nUP (in empty input field): Edit your last message in the current channel\n@[character]+TAB: Autocomplete @username beginning with [character]\n#[character]+TAB: Autocomplete channel beginning with [character]\n:[character]+TAB: Autocomplete emoji beginning with [character]\n\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "api.command_shortcuts.name",
|
"id": "api.command_shortcuts.name",
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import UserStore from 'stores/user_store.jsx';
|
|||||||
|
|
||||||
import {loadStatusesForChannel} from 'actions/status_actions.jsx';
|
import {loadStatusesForChannel} from 'actions/status_actions.jsx';
|
||||||
|
|
||||||
import * as PostUtils from 'utils/post_utils.jsx';
|
|
||||||
import Client from 'client/web_client.jsx';
|
import Client from 'client/web_client.jsx';
|
||||||
import * as AsyncClient from 'utils/async_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) {
|
export function flagPost(postId) {
|
||||||
AsyncClient.savePreference(Preferences.CATEGORY_FLAGGED_POST, postId, 'true');
|
AsyncClient.savePreference(Preferences.CATEGORY_FLAGGED_POST, postId, 'true');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import PostHeader from './post_header.jsx';
|
import PostHeader from './post_header.jsx';
|
||||||
import PostBody from './post_body.jsx';
|
import PostBody from './post_body.jsx';
|
||||||
import ProfilePicture from 'components/profile_picture.jsx';
|
import ProfilePicture from 'components/profile_picture.jsx';
|
||||||
import * as PostActions from 'actions/post_actions.jsx';
|
|
||||||
|
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
const ActionTypes = Constants.ActionTypes;
|
const ActionTypes = Constants.ActionTypes;
|
||||||
@@ -22,7 +21,6 @@ export default class Post extends React.Component {
|
|||||||
this.handleCommentClick = this.handleCommentClick.bind(this);
|
this.handleCommentClick = this.handleCommentClick.bind(this);
|
||||||
this.handleDropdownOpened = this.handleDropdownOpened.bind(this);
|
this.handleDropdownOpened = this.handleDropdownOpened.bind(this);
|
||||||
this.forceUpdateInfo = this.forceUpdateInfo.bind(this);
|
this.forceUpdateInfo = this.forceUpdateInfo.bind(this);
|
||||||
this.handlePostClick = this.handlePostClick.bind(this);
|
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
dropdownOpened: false
|
dropdownOpened: false
|
||||||
@@ -50,12 +48,7 @@ export default class Post extends React.Component {
|
|||||||
this.refs.info.forceUpdate();
|
this.refs.info.forceUpdate();
|
||||||
this.refs.header.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) {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
if (!Utils.areObjectsEqual(nextProps.post, this.props.post)) {
|
if (!Utils.areObjectsEqual(nextProps.post, this.props.post)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -238,7 +231,6 @@ export default class Post extends React.Component {
|
|||||||
<div
|
<div
|
||||||
id={'post_' + post.id}
|
id={'post_' + post.id}
|
||||||
className={'post ' + sameUserClass + ' ' + compactClass + ' ' + rootUser + ' ' + postType + ' ' + currentUserCss + ' ' + shouldHighlightClass + ' ' + systemMessageClass + ' ' + hideControls + ' ' + dropdownOpenedClass}
|
className={'post ' + sameUserClass + ' ' + compactClass + ' ' + rootUser + ' ' + postType + ' ' + currentUserCss + ' ' + shouldHighlightClass + ' ' + systemMessageClass + ' ' + hideControls + ' ' + dropdownOpenedClass}
|
||||||
onClick={this.handlePostClick}
|
|
||||||
>
|
>
|
||||||
<div className={'post__content ' + centerClass}>
|
<div className={'post__content ' + centerClass}>
|
||||||
{profilePicContainer}
|
{profilePicContainer}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user