Fixed mention without username

This commit is contained in:
Igor Zhukov 2016-07-04 16:56:17 +03:00
parent aa607bb3bf
commit efbe340c09
3 changed files with 11 additions and 9 deletions

View File

@ -1433,7 +1433,6 @@ angular.module('izhukov.utils', [])
})
rawOffset -= 2
} else if (match[10]) { // custom mention
console.log(match);
newText.push(text)
entities.push({
_: 'messageEntityMentionName',
@ -1597,11 +1596,10 @@ angular.module('izhukov.utils', [])
break
case 'messageEntityMentionName':
if (!options.noLinks) {
if (options.noLinks) {
skipEntity = true
break
}
var username = entityText.substr(1)
html.push(
'<a href="#/im?p=u',
encodeURIComponent(entity.user_id),

View File

@ -1258,6 +1258,10 @@ angular.module('myApp.services')
if (!options.viaBotID) {
text = RichTextProcessor.parseMarkdown(text, entities)
}
if (!text.length) {
return
}
var sendEntites = entities
if (entities.length) {
sendEntites = angular.copy(entities)
@ -1269,9 +1273,6 @@ angular.module('myApp.services')
})
}
if (!text.length) {
return
}
var messageID = tempID--
var randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)]
@ -1319,7 +1320,7 @@ angular.module('myApp.services')
reply_to_msg_id: replyToMsgID,
via_bot_id: options.viaBotID,
reply_markup: options.reply_markup,
entities: sendEntites,
entities: entities,
views: asChannel && 1,
pending: true
}
@ -1367,7 +1368,7 @@ angular.module('myApp.services')
id: options.resultID
}, sentRequestOptions)
} else {
if (entities.length) {
if (sendEntites.length) {
flags |= 8
}
apiPromise = MtpApiManager.invokeApi('messages.sendMessage', {
@ -1376,7 +1377,7 @@ angular.module('myApp.services')
message: text,
random_id: randomID,
reply_to_msg_id: AppMessagesIDsManager.getMessageLocalID(replyToMsgID),
entities: entities
entities: sendEntites
}, sentRequestOptions)
}
// console.log(flags, entities)

View File

@ -928,6 +928,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function resolveUsername (username) {
var searchUserName = SearchIndexManager.cleanUsername(username)
if (searchUserName.match(/^\d+$/)) {
return qSync.when(false)
}
var foundUserID
var foundChatID, foundPeerID
var foundUsername