[MM-59375] Use readMultipleChannels to mark as read on server as well (#29280)

* [MM-59375] Use `readMultipleChannels` to mark as read on server as well

* Fix types

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Devin Binnie
2024-11-18 10:50:25 -05:00
коммит произвёл GitHub
родитель 9e05c075ff
Коммит 9fffbb68d6
3 изменённых файлов: 5 добавлений и 5 удалений

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

@@ -6,7 +6,7 @@ import type {ConnectedProps} from 'react-redux';
import type {Channel} from '@mattermost/types/channels'; import type {Channel} from '@mattermost/types/channels';
import {favoriteChannel, unfavoriteChannel, markMultipleChannelsAsRead} from 'mattermost-redux/actions/channels'; import {favoriteChannel, unfavoriteChannel, readMultipleChannels} from 'mattermost-redux/actions/channels';
import Permissions from 'mattermost-redux/constants/permissions'; import Permissions from 'mattermost-redux/constants/permissions';
import {isFavoriteChannel} from 'mattermost-redux/selectors/entities/channels'; import {isFavoriteChannel} from 'mattermost-redux/selectors/entities/channels';
import {getMyChannelMemberships, getCurrentUserId} from 'mattermost-redux/selectors/entities/common'; import {getMyChannelMemberships, getCurrentUserId} from 'mattermost-redux/selectors/entities/common';
@@ -55,7 +55,7 @@ function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
} }
const mapDispatchToProps = { const mapDispatchToProps = {
markMultipleChannelsAsRead, readMultipleChannels,
markMostRecentPostInChannelAsUnread, markMostRecentPostInChannelAsUnread,
favoriteChannel, favoriteChannel,
unfavoriteChannel, unfavoriteChannel,

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

@@ -43,7 +43,7 @@ describe('components/sidebar/sidebar_channel/sidebar_channel_menu', () => {
onToggleMenu: jest.fn(), onToggleMenu: jest.fn(),
multiSelectedChannelIds: [], multiSelectedChannelIds: [],
displayedChannels: [], displayedChannels: [],
markMultipleChannelsAsRead: jest.fn(), readMultipleChannels: jest.fn(),
markMostRecentPostInChannelAsUnread: jest.fn(), markMostRecentPostInChannelAsUnread: jest.fn(),
favoriteChannel: jest.fn(), favoriteChannel: jest.fn(),
unfavoriteChannel: jest.fn(), unfavoriteChannel: jest.fn(),

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

@@ -39,7 +39,7 @@ const SidebarChannelMenu = ({
isUnread, isUnread,
managePrivateChannelMembers, managePrivateChannelMembers,
managePublicChannelMembers, managePublicChannelMembers,
markMultipleChannelsAsRead, readMultipleChannels,
markMostRecentPostInChannelAsUnread, markMostRecentPostInChannelAsUnread,
muteChannel, muteChannel,
onMenuToggle, onMenuToggle,
@@ -56,7 +56,7 @@ const SidebarChannelMenu = ({
if (isUnread) { if (isUnread) {
function handleMarkAsRead() { function handleMarkAsRead() {
// We use mark multiple to not update the active channel in the server // We use mark multiple to not update the active channel in the server
markMultipleChannelsAsRead({[channel.id]: Date.now()}); readMultipleChannels([channel.id]);
trackEvent('ui', 'ui_sidebar_channel_menu_markAsRead'); trackEvent('ui', 'ui_sidebar_channel_menu_markAsRead');
} }