Просмотр исходного кода

Merge pull request #216 from crowi/user-list-by-local-cache

Use local cache
Sotaro KARASAWA 9 лет назад
Родитель
Сommit
eb03a98c56
2 измененных файлов с 2 добавлено и 9 удалено
  1. 1 1
      resource/js/app.js
  2. 1 8
      resource/js/components/SeenUserList.js

+ 1 - 1
resource/js/app.js

@@ -48,7 +48,7 @@ const componentMappings = {
 
 
   //'revision-history': <PageHistory pageId={pageId} />,
   //'revision-history': <PageHistory pageId={pageId} />,
   //'page-comment': <PageComment />,
   //'page-comment': <PageComment />,
-  'seen-user-list': <SeenUserList />,
+  'seen-user-list': <SeenUserList pageId={pageId} crowi={crowi} />,
   'bookmark-button': <BookmarkButton pageId={pageId} crowi={crowi} />,
   'bookmark-button': <BookmarkButton pageId={pageId} crowi={crowi} />,
 };
 };
 
 

+ 1 - 8
resource/js/components/SeenUserList.js

@@ -6,8 +6,6 @@ export default class SeenUserList extends React.Component {
   constructor(props) {
   constructor(props) {
     super(props);
     super(props);
 
 
-    this.crowi = window.crowi; // FIXME
-
     this.state = {
     this.state = {
       seenUsers: [],
       seenUsers: [],
     };
     };
@@ -18,12 +16,7 @@ export default class SeenUserList extends React.Component {
 
 
     if (seenUserIds.length > 0) {
     if (seenUserIds.length > 0) {
       // FIXME: user data cache
       // FIXME: user data cache
-      this.crowi.apiGet('/users.list', {user_ids: seenUserIds.join(',')})
-      .then(res => {
-        this.setState({seenUsers: res.users});
-      }).catch(err => {
-        // do nothing
-      });
+      this.setState({seenUsers: this.props.crowi.findUserByIds(seenUserIds)});
     }
     }
   }
   }