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
Этот коммит содержится в:
Joram Wilander
2016-12-21 16:35:01 -05:00
коммит произвёл Christopher Speller
родитель 139cb52c99
Коммит ba6e370ca7
17 изменённых файлов: 386 добавлений и 276 удалений

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

@@ -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();
}
}
}