PLT-5012 Combine updateLastViewedAt, setLastViewedAt and setActiveChannel into a single API (#4840)
* Combine updateLastViewedAt, setLastViewedAt and setActiveChannel into a single API * Remove preference DB writes
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
139cb52c99
Коммит
ba6e370ca7
@@ -53,7 +53,7 @@ export function executeCommand(message, args, success, error) {
|
||||
|
||||
export function setChannelAsRead(channelIdParam) {
|
||||
const channelId = channelIdParam || ChannelStore.getCurrentId();
|
||||
AsyncClient.updateLastViewedAt();
|
||||
AsyncClient.viewChannel();
|
||||
ChannelStore.resetCounts(channelId);
|
||||
ChannelStore.emitChange();
|
||||
if (channelId === ChannelStore.getCurrentId()) {
|
||||
|
||||
@@ -48,7 +48,7 @@ export function emitChannelClickEvent(channel) {
|
||||
|
||||
getMyChannelMembersPromise.then(() => {
|
||||
AsyncClient.getChannelStats(chan.id, true);
|
||||
AsyncClient.updateLastViewedAt(chan.id);
|
||||
AsyncClient.viewChannel(chan.id, ChannelStore.getCurrentId());
|
||||
loadPosts(chan.id);
|
||||
trackPage();
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ export function handleNewPost(post, msg) {
|
||||
|
||||
if (ChannelStore.getCurrentId() === post.channel_id) {
|
||||
if (window.isActive) {
|
||||
AsyncClient.updateLastViewedAt(null, false);
|
||||
AsyncClient.viewChannel();
|
||||
} else {
|
||||
AsyncClient.getChannel(post.channel_id);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ function handlePostEditEvent(msg) {
|
||||
// Update channel state
|
||||
if (ChannelStore.getCurrentId() === msg.broadcast.channel_id) {
|
||||
if (window.isActive) {
|
||||
AsyncClient.updateLastViewedAt(null, false);
|
||||
AsyncClient.viewChannel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user