Skip unallowed text entities instead of failing request.

GitOrigin-RevId: d5e22ac01e9d03bf62ebfbbb83a681f48b26b30d
This commit is contained in:
levlam 2018-01-31 15:01:53 +03:00
parent 0b344f1c74
commit d5d78dd1d3

View File

@ -1585,15 +1585,11 @@ Result<vector<MessageEntity>> get_message_entities(const ContactsManager *contac
switch (entity->type_->get_id()) { switch (entity->type_->get_id()) {
case td_api::textEntityTypeMention::ID: case td_api::textEntityTypeMention::ID:
return Status::Error(400, "EntityMention can't be used in outgoing messages");
case td_api::textEntityTypeHashtag::ID: case td_api::textEntityTypeHashtag::ID:
return Status::Error(400, "EntityHashtag can't be used in outgoing messages");
case td_api::textEntityTypeBotCommand::ID: case td_api::textEntityTypeBotCommand::ID:
return Status::Error(400, "EntityBotCommand can't be used in outgoing messages");
case td_api::textEntityTypeUrl::ID: case td_api::textEntityTypeUrl::ID:
return Status::Error(400, "EntityUrl can't be used in outgoing messages");
case td_api::textEntityTypeEmailAddress::ID: case td_api::textEntityTypeEmailAddress::ID:
return Status::Error(400, "EntityEmailAddress can't be used in outgoing messages"); break;
case td_api::textEntityTypeBold::ID: case td_api::textEntityTypeBold::ID:
entities.emplace_back(MessageEntity::Type::Bold, entity->offset_, entity->length_); entities.emplace_back(MessageEntity::Type::Bold, entity->offset_, entity->length_);
break; break;