add tld check
This commit is contained in:
@@ -928,9 +928,7 @@ class MessageInputState extends State<MessageInput>
|
|||||||
_actionsShrunk = value.isNotEmpty && actionsLength > 1;
|
_actionsShrunk = value.isNotEmpty && actionsLength > 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (channel.ownCapabilities.contains(PermissionType.sendLinks)) {
|
_checkContainsUrl(value, context);
|
||||||
_checkContainsUrl(value, context);
|
|
||||||
}
|
|
||||||
_checkCommands(value, context);
|
_checkCommands(value, context);
|
||||||
_checkMentions(value, context);
|
_checkMentions(value, context);
|
||||||
_checkEmoji(value, context);
|
_checkEmoji(value, context);
|
||||||
@@ -971,7 +969,11 @@ class MessageInputState extends State<MessageInput>
|
|||||||
..removeWhere((it) => it.group(0)?.split('.').last.isValidTLD() == false);
|
..removeWhere((it) => it.group(0)?.split('.').last.isValidTLD() == false);
|
||||||
|
|
||||||
// Reset the og attachment if the text doesn't contain any url
|
// Reset the og attachment if the text doesn't contain any url
|
||||||
if (matchedUrls.isEmpty) {
|
if (matchedUrls.isEmpty ||
|
||||||
|
!StreamChannel.of(context)
|
||||||
|
.channel
|
||||||
|
.ownCapabilities
|
||||||
|
.contains(PermissionType.sendLinks)) {
|
||||||
_effectiveController
|
_effectiveController
|
||||||
..text = value
|
..text = value
|
||||||
..clearOGAttachment();
|
..clearOGAttachment();
|
||||||
@@ -1652,7 +1654,8 @@ class MessageInputState extends State<MessageInput>
|
|||||||
var message = _effectiveController.value;
|
var message = _effectiveController.value;
|
||||||
if (!streamChannel.channel.ownCapabilities
|
if (!streamChannel.channel.ownCapabilities
|
||||||
.contains(PermissionType.sendLinks) &&
|
.contains(PermissionType.sendLinks) &&
|
||||||
_urlRegex.hasMatch(message.text ?? '')) {
|
_urlRegex.allMatches(message.text ?? '').any((element) =>
|
||||||
|
element.group(0)?.split('.').last.isValidTLD() == true)) {
|
||||||
showInfoDialog(
|
showInfoDialog(
|
||||||
context,
|
context,
|
||||||
icon: StreamSvgIcon.error(
|
icon: StreamSvgIcon.error(
|
||||||
|
|||||||
Reference in New Issue
Block a user