[MM-37840, MM-37841] do not mark channel as read when clearing push notifications (#5623) (#5624)

* MM-37840 do not mark channel as read when clearing push notifications

* MM-37841 prevent from setting the edit post screen buttons with every key press

(cherry picked from commit a44a19d125)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Mattermost Build 2021-08-13 19:09:37 +02:00 committed by GitHub
parent 4549ecdd94
commit c0fb9aa4ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -193,7 +193,9 @@ const NetworkIndicator = ({
useEffect(() => {
if (channelId) {
clearNotificationTimeout.current = setTimeout(clearNotifications, 1500);
clearNotificationTimeout.current = setTimeout(() => {
PushNotifications.clearChannelNotifications(channelId);
}, 1500);
}
return () => {

View file

@ -68,6 +68,7 @@ export default class EditPost extends PureComponent {
this.rightButton.color = props.theme.sidebarHeaderTextColor;
this.rightButton.text = context.intl.formatMessage({id: 'edit_post.save', defaultMessage: 'Save'});
this.rightButtonEnabled = true;
setButtons(props.componentId, {
leftButtons: [{...this.leftButton, icon: props.closeButton}],
@ -99,14 +100,18 @@ export default class EditPost extends PureComponent {
emitCanEditPost = (enabled) => {
const {componentId} = this.props;
setButtons(componentId, {
leftButtons: [{...this.leftButton, icon: this.props.closeButton}],
rightButtons: [{...this.rightButton, enabled}],
});
if (this.rightButtonEnabled !== enabled) {
this.rightButtonEnabled = enabled;
setButtons(componentId, {
leftButtons: [{...this.leftButton, icon: this.props.closeButton}],
rightButtons: [{...this.rightButton, enabled}],
});
}
};
emitEditing = (loading) => {
const {componentId} = this.props;
this.rightButtonEnabled = !loading;
setButtons(componentId, {
leftButtons: [{...this.leftButton, icon: this.props.closeButton}],
rightButtons: [{...this.rightButton, enabled: !loading}],