@@ -5,11 +5,11 @@ import {
55 UPDATE_MESSAGES ,
66 UPDATE_USERS ,
77 UPDATE_POINTER ,
8- } from '../constants.js ' ;
8+ } from '../constants' ;
99
1010export function markAsRead ( messages ) {
1111 return ( dispatch , getState ) => {
12- const config = getState ( ) . config ;
12+ const { config } = getState ( ) ;
1313 const z = zulip ( config ) ;
1414 const flag = 'read' ;
1515 return z . messages . flags . add ( { flag, messages } ) ;
@@ -18,7 +18,7 @@ export function markAsRead(messages) {
1818
1919export function updatePointer ( id ) {
2020 return ( dispatch , getState ) => {
21- const config = getState ( ) . config ;
21+ const { config } = getState ( ) ;
2222 return zulip ( config ) . users . me . pointer . update ( id ) . then ( ( { result } ) => {
2323 if ( result === 'success' ) {
2424 dispatch ( {
@@ -43,7 +43,7 @@ export function fetchPointer(dispatch, config) {
4343
4444export function fetchStreams ( redirect ) {
4545 return ( dispatch , getState ) => {
46- const config = getState ( ) . config ;
46+ const { config } = getState ( ) ;
4747 const z = zulip ( config ) ;
4848 return z . streams . retrieve ( ) . then ( ( res ) => {
4949 dispatch ( {
@@ -57,14 +57,13 @@ export function fetchStreams(redirect) {
5757
5858export function fetchMessages ( anchor ) {
5959 return ( dispatch , getState ) => {
60- const config = getState ( ) . config ;
60+ const { config, messages } = getState ( ) ;
6161 const params = {
6262 num_before : 10 ,
6363 num_after : 20 ,
6464 anchor,
6565 } ;
6666 if ( ! anchor ) {
67- const messages = getState ( ) . messages ;
6867 const lastMessage = messages [ messages . length - 1 ] ;
6968 params . num_before = 0 ;
7069 params . anchor = lastMessage . id ;
@@ -80,7 +79,7 @@ export function fetchMessages(anchor) {
8079
8180export function fetchUsers ( redirect ) {
8281 return ( dispatch , getState ) => {
83- const config = getState ( ) . config ;
82+ const { config } = getState ( ) ;
8483 const z = zulip ( config ) ;
8584 return z . users . retrieve ( { } ) . then ( ( res ) => {
8685 const users = [ ] . concat ( res . members ) ;
0 commit comments