Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Person Icons, Emojis, Images, Group Title +N #3

Merged
merged 19 commits into from
Jan 9, 2024

Conversation

andrewDoing
Copy link
Collaborator

Closes 307, 360, 370

PR Type

Description of the changes

PR checklist

  • Project builds (yarn build) and changes have been tested in at least two supported browsers (Edge + non-Chromium based browser)
  • All public APIs (classes, methods, etc) have been documented following the jsdoc syntax
  • Stories have been added and existing stories have been tested
  • Added appropriate documentation. Docs PR:
  • License header has been added to all new source files (yarn setLicense)
  • Contains NO breaking changes

Other information

}

return removeHtmlPTags(previewString);
// removes <p> tags from the string
previewString = removeHtmlPTags(previewString);
Copy link
Owner

@plasne plasne Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't address <span /> or <div /> tags or any number of other HTML that could appear. Maybe consider: https://www.npmjs.com/package/html-to-text. You may still want to keep the "Sent an image." path and the emoji path.

// handle images
const graphImageUrlRegex = /<img[^>]+?src=["']https:\/\/graph\.microsoft\.com\/[^"'>]+?["']/;

const imageMatch = content.match(graphImageUrlRegex);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crashes with an error if content is null | undefined. You can probably just shortcut out of this method if there is no preview.

// define the JSX for FluentUI Icons + Styling
const oneOnOneProfilePicture = <ChatListItemIcon chatType="oneOnOne" />;
const GroupProfilePicture = <ChatListItemIcon chatType="group" />;

const other = chatObj.members?.find(m => (m as AadUserConversationMember).userId !== myId);
const otherAad = other as AadUserConversationMember;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to have a bot icon for bots which are applications, not conversation members. Or at a minimum they should use the default icon and not the user's icon.

Because the chat component comes from ACS, it doesn't actually send info about the bot, so that control just uses the default icon.

}

return removeHtmlPTags(previewString);
// removes <p> tags from the string
previewString = removeHtmlPTags(previewString);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this should happen on content not necessarily previewString and be moved up above the "handle general chats" section.

} else if (previewMessage?.from?.application?.displayName) {
previewString = previewMessage?.from?.application?.displayName + ': ' + previewMessage?.body?.content;
previewString = previewMessage?.from?.application?.displayName + ': ' + content;
}

// handle all events
if (previewMessage?.eventDetail) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this doing anything?

Copy link
Collaborator Author

@andrewDoing andrewDoing Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 234 handles the preview message being from a bot, Line 238 handles events like "Member Added"

@plasne
Copy link
Owner

plasne commented Jan 8, 2024

Your demo was great. I think there was one issue with a drag-and-drop image. If you fix that, then I will approve. Thanks, Peter.

@TechnicallyWilliams TechnicallyWilliams self-requested a review January 9, 2024 16:11
Copy link

github-actions bot commented Jan 9, 2024

Code Coverage

Package Line Rate Branch Rate Complexity Health
mgt-chat.src.statefulClient 100% 100% 0
mgt-chat.src.utils 100% 96% 0
mgt-components.dist.es6.components.mgt-agenda.src.components.mgt-agenda 12% 100% 0
mgt-components.dist.es6.components.mgt-contact.src.components.mgt-contact 62% 100% 0
mgt-components.dist.es6.components.mgt-file-list.mgt-file-upload.src.components.mgt-file-list.mgt-file-upload 43% 100% 0
mgt-components.dist.es6.components.mgt-file-list.src.components.mgt-file-list 51% 100% 0
mgt-components.dist.es6.components.mgt-file.src.components.mgt-file 46% 100% 0
mgt-components.dist.es6.components.mgt-get.src.components.mgt-get 20% 100% 0
mgt-components.dist.es6.components.mgt-login.src.components.mgt-login 63% 100% 0
mgt-components.dist.es6.components.mgt-messages.src.components.mgt-messages 65% 100% 0
mgt-components.dist.es6.components.mgt-organization.src.components.mgt-organization 46% 100% 0
mgt-components.dist.es6.components.mgt-people-picker.src.components.mgt-people-picker 49% 100% 0
mgt-components.dist.es6.components.mgt-people.src.components.mgt-people 59% 100% 0
mgt-components.dist.es6.components.mgt-person-card.src.components.mgt-person-card 53% 33% 0
mgt-components.dist.es6.components.mgt-person.src.components.mgt-person 48% 100% 0
mgt-components.dist.es6.components.mgt-picker.src.components.mgt-picker 75% 100% 0
mgt-components.dist.es6.components.mgt-profile.src.components.mgt-profile 39% 100% 0
mgt-components.dist.es6.components.mgt-tasks-base.src.components.mgt-tasks-base 76% 100% 0
mgt-components.dist.es6.components.mgt-tasks.src.components.mgt-tasks 54% 100% 0
mgt-components.dist.es6.components.mgt-taxonomy-picker.src.components.mgt-taxonomy-picker 62% 100% 0
mgt-components.dist.es6.components.mgt-teams-channel-picker.src.components.mgt-teams-channel-picker 55% 100% 0
mgt-components.dist.es6.components.mgt-theme-toggle.src.components.mgt-theme-toggle 74% 100% 0
mgt-components.dist.es6.components.mgt-todo.src.components.mgt-todo 80% 100% 0
mgt-components.dist.es6.components.preview.mgt-search-box.src.components.preview.mgt-search-box 74% 100% 0
mgt-components.dist.es6.components.preview.mgt-search-results.src.components.preview.mgt-search-results 51% 100% 0
mgt-components.dist.es6.components.preview.src.components.preview 100% 100% 0
mgt-components.dist.es6.components.src.components 82% 100% 0
mgt-components.dist.es6.components.sub-components.mgt-arrow-options.src.components.sub-components.mgt-arrow-options 70% 100% 0
mgt-components.dist.es6.components.sub-components.mgt-dot-options.src.components.sub-components.mgt-dot-options 28% 100% 0
mgt-components.dist.es6.components.sub-components.mgt-flyout.src.components.sub-components.mgt-flyout 40% 100% 0
mgt-components.dist.es6.components.sub-components.mgt-spinner.src.components.sub-components.mgt-spinner 92% 100% 0
mgt-components.dist.es6.graph.src.graph 36% 100% 0
mgt-components.dist.es6.src 100% 100% 0
mgt-components.dist.es6.styles.src.styles 73% 100% 0
mgt-components.dist.es6.utils.src.utils 45% 100% 0
mgt-components.src.components 81% 100% 0
mgt-components.src.components.mgt-contact 68% 83% 0
mgt-components.src.components.mgt-file 51% 100% 0
mgt-components.src.components.mgt-file-list 56% 100% 0
mgt-components.src.components.mgt-file-list.mgt-file-upload 49% 88% 0
mgt-components.src.components.mgt-messages 66% 100% 0
mgt-components.src.components.mgt-organization 47% 100% 0
mgt-components.src.components.mgt-person 79% 65% 0
mgt-components.src.components.mgt-person-card 66% 47% 0
mgt-components.src.components.mgt-profile 40% 100% 0
mgt-components.src.components.mgt-theme-toggle 100% 100% 0
mgt-components.src.components.sub-components.mgt-flyout 72% 53% 0
mgt-components.src.components.sub-components.mgt-spinner 100% 100% 0
mgt-components.src.graph 39% 89% 0
mgt-components.src.styles 92% 80% 0
mgt-components.src.utils 79% 28% 0
mgt-element.dist.es6.components.src.components 73% 81% 0
mgt-element.dist.es6.mock.src.mock 90% 67% 0
mgt-element.dist.es6.providers.src.providers 85% 69% 0
mgt-element.dist.es6.src 91% 80% 0
mgt-element.dist.es6.utils.src.utils 66% 69% 0
mgt-element.src 88% 100% 0
mgt-element.src.components 84% 100% 0
mgt-element.src.mock 81% 56% 0
mgt-element.src.providers 80% 85% 0
mgt-element.src.utils 71% 90% 0
Summary 57% (25320 / 44630) 65% (448 / 684) 0

@andrewDoing andrewDoing merged commit 87287dd into next/mgt-chat Jan 9, 2024
4 checks passed
@andrewDoing andrewDoing deleted the andrewDoing/person-icon branch January 9, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants