mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-54173 group mention punctuation (#24402)
Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
f2fcf3d839
commit
a2adc0e33e
@ -1,27 +1,56 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`components/AtMention should match snapshot when mentioning a group that is allowed reference 1`] = `
|
||||
<span>
|
||||
<Memo(AtMentionGroup)
|
||||
group={
|
||||
Object {
|
||||
"allow_reference": true,
|
||||
"create_at": 1,
|
||||
"delete_at": 0,
|
||||
"description": "",
|
||||
"display_name": "group_display_name",
|
||||
"has_syncables": false,
|
||||
"id": "qwerty1",
|
||||
"member_count": 0,
|
||||
"name": "developers",
|
||||
"remote_id": "",
|
||||
"scheme_admin": false,
|
||||
"source": "",
|
||||
"update_at": 1,
|
||||
exports[`components/AtMention should match snapshot when mentioning a group followed by punctuation 1`] = `
|
||||
<Fragment>
|
||||
<span>
|
||||
<Memo(AtMentionGroup)
|
||||
group={
|
||||
Object {
|
||||
"allow_reference": true,
|
||||
"create_at": 1,
|
||||
"delete_at": 0,
|
||||
"description": "",
|
||||
"display_name": "group_display_name",
|
||||
"has_syncables": false,
|
||||
"id": "qwerty1",
|
||||
"member_count": 0,
|
||||
"name": "developers",
|
||||
"remote_id": "",
|
||||
"scheme_admin": false,
|
||||
"source": "",
|
||||
"update_at": 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
/>
|
||||
</span>
|
||||
/>
|
||||
</span>
|
||||
.
|
||||
</Fragment>
|
||||
`;
|
||||
|
||||
exports[`components/AtMention should match snapshot when mentioning a group that is allowed reference 1`] = `
|
||||
<Fragment>
|
||||
<span>
|
||||
<Memo(AtMentionGroup)
|
||||
group={
|
||||
Object {
|
||||
"allow_reference": true,
|
||||
"create_at": 1,
|
||||
"delete_at": 0,
|
||||
"description": "",
|
||||
"display_name": "group_display_name",
|
||||
"has_syncables": false,
|
||||
"id": "qwerty1",
|
||||
"member_count": 0,
|
||||
"name": "developers",
|
||||
"remote_id": "",
|
||||
"scheme_admin": false,
|
||||
"source": "",
|
||||
"update_at": 1,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</span>
|
||||
</Fragment>
|
||||
`;
|
||||
|
||||
exports[`components/AtMention should match snapshot when mentioning a group that is allowed reference with group highlight disabled 1`] = `
|
||||
|
@ -214,6 +214,19 @@ describe('components/AtMention', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should match snapshot when mentioning a group followed by punctuation', () => {
|
||||
const wrapper = shallow<AtMention>(
|
||||
<AtMention
|
||||
{...baseProps}
|
||||
mentionName='developers.'
|
||||
>
|
||||
{'(at)-developers.'}
|
||||
</AtMention>,
|
||||
);
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should have placement state based on ref position of click handler', () => {
|
||||
const wrapper = shallow<AtMention>(
|
||||
<AtMention
|
||||
|
@ -90,10 +90,18 @@ export default class AtMention extends React.PureComponent<Props, State> {
|
||||
|
||||
if (!this.props.disableGroupHighlight && !user) {
|
||||
const group = getUserOrGroupFromMentionName(this.props.groupsByName, this.props.mentionName) as Group | '';
|
||||
|
||||
if (group && group.allow_reference) {
|
||||
return (<span>
|
||||
<AtMentionGroup group={group}/>
|
||||
</span>);
|
||||
const suffix = this.props.mentionName.substring(group.name.length);
|
||||
|
||||
return (
|
||||
<>
|
||||
<span>
|
||||
<AtMentionGroup group={group}/>
|
||||
</span>
|
||||
{suffix}
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user