clientjs/packages/dashboard-components/src/actions.js
changeset 4 df751568fda6
parent 0 5f4fcbc80b37
--- a/clientjs/packages/dashboard-components/src/actions.js	Mon Sep 17 00:28:58 2018 +0200
+++ b/clientjs/packages/dashboard-components/src/actions.js	Mon Sep 17 01:35:46 2018 +0200
@@ -2,7 +2,7 @@
 import fetch from 'isomorphic-fetch';
 import _ from 'lodash';
 
-import { getTerms, toBase64 } from './utils';
+import { getTerms, getTermId } from './utils';
 
 
 export const REQUEST_ANNOTATIONS = 'REQUEST_ANNOTATIONS';
@@ -45,9 +45,9 @@
 }
 
 export const FETCH_MESSAGES_COUNT = 'FETCH_MESSAGES_COUNT';
-export function fetchMessagesCount(terms, discussionUrl) {
+export function fetchMessagesCount(terms, discussionUrl, dashboardId) {
   const url = `${discussionUrl}count`;
-  const terms64 = _.map(terms, toBase64);
+  const terms64 = _.map(terms, term => getTermId(term, dashboardId));
 
   return function (dispatch) {
     dispatch(requestMessagesCount(url, terms, terms64));
@@ -74,7 +74,7 @@
 }
 
 export const FETCH_ANNOTATIONS = 'FETCH_ANNOTATIONS';
-export function fetchAnnotations(url, discussionUrl) {
+export function fetchAnnotations(url, discussionUrl, dashboardId) {
   return function (dispatch) {
     dispatch(requestAnnotations(url));
 
@@ -87,7 +87,7 @@
         const annotations = json.rows;
         const terms = getTerms(annotations);
 
-        dispatch(fetchMessagesCount(Object.keys(terms), discussionUrl));
+        dispatch(fetchMessagesCount(Object.keys(terms), discussionUrl, dashboardId));
         dispatch(receiveAnnotations(url, annotations, terms));
       });
   };