fix(tl): cross-schema conflict resolution leading to missing references
This commit is contained in:
parent
137f1cc81b
commit
fcab8a5882
3 changed files with 10 additions and 6 deletions
File diff suppressed because one or more lines are too long
|
@ -66,7 +66,6 @@
|
||||||
"messageActionInviteToGroupCall": ["users"],
|
"messageActionInviteToGroupCall": ["users"],
|
||||||
"messageEntityMentionName": ["user_id"],
|
"messageEntityMentionName": ["user_id"],
|
||||||
"messageMediaContact": ["user_id"],
|
"messageMediaContact": ["user_id"],
|
||||||
"messageMediaStory": ["user_id"],
|
|
||||||
"messageReplies": ["channel_id"],
|
"messageReplies": ["channel_id"],
|
||||||
"messageReplyStoryHeader": ["user_id"],
|
"messageReplyStoryHeader": ["user_id"],
|
||||||
"messageUserVote": ["user_id"],
|
"messageUserVote": ["user_id"],
|
||||||
|
@ -129,10 +128,8 @@
|
||||||
"updateReadChannelDiscussionOutbox": ["channel_id"],
|
"updateReadChannelDiscussionOutbox": ["channel_id"],
|
||||||
"updateReadChannelInbox": ["channel_id"],
|
"updateReadChannelInbox": ["channel_id"],
|
||||||
"updateReadChannelOutbox": ["channel_id"],
|
"updateReadChannelOutbox": ["channel_id"],
|
||||||
"updateReadStories": ["user_id"],
|
|
||||||
"updateShortChatMessage": ["from_id", "chat_id", "via_bot_id"],
|
"updateShortChatMessage": ["from_id", "chat_id", "via_bot_id"],
|
||||||
"updateShortMessage": ["user_id", "via_bot_id"],
|
"updateShortMessage": ["user_id", "via_bot_id"],
|
||||||
"updateStory": ["user_id"],
|
|
||||||
"updateUserEmojiStatus": ["user_id"],
|
"updateUserEmojiStatus": ["user_id"],
|
||||||
"updateUserName": ["user_id"],
|
"updateUserName": ["user_id"],
|
||||||
"updateUserPhone": ["user_id"],
|
"updateUserPhone": ["user_id"],
|
||||||
|
@ -144,7 +141,6 @@
|
||||||
"userFull": ["id"],
|
"userFull": ["id"],
|
||||||
"userStories": ["user_id"],
|
"userStories": ["user_id"],
|
||||||
"webAuthorization": ["bot_id"],
|
"webAuthorization": ["bot_id"],
|
||||||
"webPageAttributeStory": ["user_id"],
|
|
||||||
"_": "Dummy line teehee~"
|
"_": "Dummy line teehee~"
|
||||||
},
|
},
|
||||||
"method": {
|
"method": {
|
||||||
|
|
|
@ -230,11 +230,19 @@ async function main() {
|
||||||
chooseOptions = options
|
chooseOptions = options
|
||||||
} else {
|
} else {
|
||||||
// first of all, prefer entries from the latest layer
|
// first of all, prefer entries from the latest layer
|
||||||
const fromLastSchema = options.filter((opt) => opt.schema.layer === resultLayer)
|
let fromLastSchema = options.filter((opt) => opt.entry && opt.schema.layer === resultLayer)
|
||||||
|
|
||||||
// if there is only one schema on the latest layer, we can simply return it
|
// if there is only one schema on the latest layer, we can simply return it
|
||||||
if (fromLastSchema.length === 1) return fromLastSchema[0].entry
|
if (fromLastSchema.length === 1) return fromLastSchema[0].entry
|
||||||
|
|
||||||
|
// the conflict was earlier, and now this entry is removed altogether.
|
||||||
|
// keep it just in case for now, as it may still be referenced somewhere
|
||||||
|
if (fromLastSchema.length === 0) {
|
||||||
|
fromLastSchema = options.sort((a, b) => b.schema.layer - a.schema.layer).filter((opt) => opt.entry)
|
||||||
|
// only keep the latest item
|
||||||
|
fromLastSchema = [fromLastSchema[0]]
|
||||||
|
}
|
||||||
|
|
||||||
// there are multiple choices on the latest layer
|
// there are multiple choices on the latest layer
|
||||||
// if they are all the same, it's just conflict between layers,
|
// if they are all the same, it's just conflict between layers,
|
||||||
// and we can merge the ones from the latest layer
|
// and we can merge the ones from the latest layer
|
||||||
|
|
Loading…
Reference in a new issue