|
@@ -49,10 +49,14 @@ export default class PageContainer extends Container {
|
|
|
path,
|
|
path,
|
|
|
tocHtml: '',
|
|
tocHtml: '',
|
|
|
isLiked: JSON.parse(mainContent.getAttribute('data-page-is-liked')),
|
|
isLiked: JSON.parse(mainContent.getAttribute('data-page-is-liked')),
|
|
|
|
|
+
|
|
|
|
|
+ seenUserIds: mainContent.getAttribute('data-page-ids-of-seen-users'),
|
|
|
seenUsers: [],
|
|
seenUsers: [],
|
|
|
- likerUsers: [],
|
|
|
|
|
countOfSeenUsers: mainContent.getAttribute('data-page-count-of-seen-users'),
|
|
countOfSeenUsers: mainContent.getAttribute('data-page-count-of-seen-users'),
|
|
|
|
|
+
|
|
|
|
|
+ likerUsers: [],
|
|
|
sumOfLikers: 0,
|
|
sumOfLikers: 0,
|
|
|
|
|
+
|
|
|
createdAt: mainContent.getAttribute('data-page-created-at'),
|
|
createdAt: mainContent.getAttribute('data-page-created-at'),
|
|
|
creator: JSON.parse(mainContent.getAttribute('data-page-creator')),
|
|
creator: JSON.parse(mainContent.getAttribute('data-page-creator')),
|
|
|
updatedAt: mainContent.getAttribute('data-page-updated-at'),
|
|
updatedAt: mainContent.getAttribute('data-page-updated-at'),
|
|
@@ -79,6 +83,7 @@ export default class PageContainer extends Container {
|
|
|
interceptorManager.addInterceptor(new DrawioInterceptor(appContainer), 20);
|
|
interceptorManager.addInterceptor(new DrawioInterceptor(appContainer), 20);
|
|
|
interceptorManager.addInterceptor(new RestoreCodeBlockInterceptor(appContainer), 900); // process as late as possible
|
|
interceptorManager.addInterceptor(new RestoreCodeBlockInterceptor(appContainer), 900); // process as late as possible
|
|
|
|
|
|
|
|
|
|
+ this.retrieveSeenUsers();
|
|
|
this.initStateMarkdown();
|
|
this.initStateMarkdown();
|
|
|
this.initStateOthers();
|
|
this.initStateOthers();
|
|
|
|
|
|
|
@@ -125,22 +130,14 @@ export default class PageContainer extends Container {
|
|
|
this.state.markdown = markdown;
|
|
this.state.markdown = markdown;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async initStateOthers() {
|
|
|
|
|
-
|
|
|
|
|
- const seenUserListElem = document.getElementById('seen-user-list');
|
|
|
|
|
- if (seenUserListElem != null) {
|
|
|
|
|
- const { userIdsStr } = seenUserListElem.dataset;
|
|
|
|
|
|
|
+ async retrieveSeenUsers() {
|
|
|
|
|
+ const { users } = await this.appContainer.apiGet('/users.list', { user_ids: this.state.seenUserIds });
|
|
|
|
|
|
|
|
- if (userIdsStr === '') {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const { users } = await this.appContainer.apiGet('/users.list', { user_ids: userIdsStr });
|
|
|
|
|
- this.setState({ seenUsers: users });
|
|
|
|
|
-
|
|
|
|
|
- this.checkAndUpdateImageUrlCached(users);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.setState({ seenUsers: users });
|
|
|
|
|
+ this.checkAndUpdateImageUrlCached(users);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ async initStateOthers() {
|
|
|
|
|
|
|
|
const likerListElem = document.getElementById('liker-list');
|
|
const likerListElem = document.getElementById('liker-list');
|
|
|
if (likerListElem != null) {
|
|
if (likerListElem != null) {
|