-
Notifications
You must be signed in to change notification settings - Fork 292
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
test: Add tests to member message rendering #15969
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #15969 +/- ##
==========================================
+ Coverage 44.29% 44.48% +0.19%
==========================================
Files 684 685 +1
Lines 22905 22899 -6
Branches 5204 5201 -3
==========================================
+ Hits 10146 10187 +41
+ Misses 11457 11398 -59
- Partials 1302 1314 +12 |
import {MemberMessage as MemberMessageEntity} from 'src/script/entity/message/MemberMessage'; | ||
import {useKoSubscribableChildren} from 'Util/ComponentUtil'; | ||
|
||
export function MessageContent({message}: {message: MemberMessageEntity}) { | ||
const {htmlCaption} = useKoSubscribableChildren(message, ['htmlCaption']); | ||
return <p className="message-header-caption" dangerouslySetInnerHTML={{__html: htmlCaption}}></p>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a follow up PR, this will be where the rendering will be done (no more dangerouslySetInnerHTML
in there)
case SystemMessageType.CONNECTION_ACCEPTED: | ||
case SystemMessageType.CONNECTION_REQUEST: { | ||
if (this.otherUser()) { | ||
if (this.otherUser().isBlocked()) { | ||
return t('conversationConnectionBlocked'); | ||
} | ||
|
||
if (this.otherUser().isOutgoingRequest()) { | ||
return ''; | ||
} | ||
} | ||
|
||
return t('conversationConnectionAccepted'); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was never reachable
readonly showLargeAvatar = (): boolean => { | ||
const largeAvatarTypes = [SystemMessageType.CONNECTION_ACCEPTED, SystemMessageType.CONNECTION_REQUEST]; | ||
return largeAvatarTypes.includes(this.memberMessageType); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has been moved to the UI component (this doesn't belong here)
176f78c
to
ebf7d79
Compare
Description
This is a preparation for a refactoring of the
MemberMessage
ui component. The idea is to remove thedangerouslySetInnerHTML
and have the rendering done inreact
directly.This covers the feature by test so that I'm sure I'm not going to break things when refactoring
Checklist