diff --git a/src/app/components/marktone.tsx b/src/app/components/marktone.tsx index 9494af1b..f3fec650 100644 --- a/src/app/components/marktone.tsx +++ b/src/app/components/marktone.tsx @@ -33,7 +33,7 @@ interface MarktoneProps { interface MentionCandidateItem { type: DirectoryEntityType; - id: number; + id: string; code: string; name: string; avatar: string; diff --git a/src/app/kintone/directory-entity.ts b/src/app/kintone/directory-entity.ts index cb729ab7..fcf65201 100644 --- a/src/app/kintone/directory-entity.ts +++ b/src/app/kintone/directory-entity.ts @@ -25,7 +25,7 @@ export class DirectoryEntityTypeUtil { export interface DirectoryEntity { type: DirectoryEntityType; - id: number; + id: string; code: string; name: string; avatar: string; diff --git a/src/app/kintone/kintone-client.ts b/src/app/kintone/kintone-client.ts index 65c037a5..975a3006 100644 --- a/src/app/kintone/kintone-client.ts +++ b/src/app/kintone/kintone-client.ts @@ -236,12 +236,12 @@ export default class KintoneClient { requestBody, ); - return response.result.entities.map((entity) => { + return response.result.entities.map(({ entityType, id, code, name }) => { return { - type: DirectoryEntityTypeUtil.valueOf(entity.entityType), - id: parseInt(entity.id, 10), - code: entity.code, - name: entity.name, + type: DirectoryEntityTypeUtil.valueOf(entityType), + id, + code, + name, avatar: "", }; }); @@ -259,27 +259,33 @@ export default class KintoneClient { requestBody, ); - const users = response.result.users.map((u) => ({ - type: DirectoryEntityType.USER, - id: parseInt(u.id, 10), - code: u.code, - name: u.name, - avatar: u.photo.size_24, - })); - const orgs = response.result.orgs.map((o) => ({ - type: DirectoryEntityType.ORGANIZATION, - id: parseInt(o.id, 10), - code: o.code, - name: o.name, - avatar: KintoneClient.presetOrganizationImageURL, - })); - const groups = response.result.groups.map((g) => ({ - type: DirectoryEntityType.GROUP, - id: parseInt(g.id, 10), - code: g.code, - name: g.name, - avatar: KintoneClient.presetGroupImageURL, - })); + const users = response.result.users.map( + ({ id, code, name, photo }) => ({ + type: DirectoryEntityType.USER, + id, + code, + name, + avatar: photo.size_24, + }), + ); + const orgs = response.result.orgs.map( + ({ id, code, name }) => ({ + type: DirectoryEntityType.ORGANIZATION, + id, + code, + name, + avatar: KintoneClient.presetOrganizationImageURL, + }), + ); + const groups = response.result.groups.map( + ({ id, code, name }) => ({ + type: DirectoryEntityType.GROUP, + id, + code, + name, + avatar: KintoneClient.presetGroupImageURL, + }), + ); return new DirectoryEntityCollection({ users, orgs, groups }); } diff --git a/src/app/markdown/replacer/mention-replacer.ts b/src/app/markdown/replacer/mention-replacer.ts index 778855b6..b04f56eb 100644 --- a/src/app/markdown/replacer/mention-replacer.ts +++ b/src/app/markdown/replacer/mention-replacer.ts @@ -30,7 +30,7 @@ class MentionReplacer { }; return ( code - .replace(/[ @%&'"<>*]/g, replacer) + .replace(/[ @%&'"<>*+]/g, replacer) // Escape Markdown syntax characters following a multi-bytes character. .replace(/(?@${entity.name}`; };