Skip to content

Commit

Permalink
Render notification progress update as html (#10588)
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew authored Jan 5, 2022
1 parent 17b419f commit 8083f76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/messages/src/browser/notification-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ export class NotificationComponent extends React.Component<NotificationComponent
<div className={`theia-notification-icon ${codicon(type)} ${type}`} />
<div className='theia-notification-message'>
<span
dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(message) }} // eslint-disable-line react/no-danger
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: DOMPurify.sanitize(message, {
ALLOW_UNKNOWN_PROTOCOLS: true // DOMPurify usually strips non http(s) links from hrefs
})
}}
onClick={this.onMessageClick}
/>
</div>
Expand Down
6 changes: 4 additions & 2 deletions packages/messages/src/browser/notifications-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,10 @@ export class NotificationManager extends MessageClient {
if (cancellationToken.isCancellationRequested) {
this.clear(messageId);
} else {
notification.message = originalMessage.text && update.message ? `${originalMessage.text}: ${update.message}` :
originalMessage.text || update?.message || notification.message;
const textMessage = originalMessage.text && update.message ? `${originalMessage.text}: ${update.message}` : originalMessage.text || update?.message;
if (textMessage) {
notification.message = this.contentRenderer.renderMessage(textMessage);
}
notification.progress = this.toPlainProgress(update) || notification.progress;
}
this.fireUpdatedEvent();
Expand Down

0 comments on commit 8083f76

Please sign in to comment.