Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flags.n?Bool is incorrectly ignored #364

Merged
merged 1 commit into from
Jul 24, 2022
Merged

Conversation

Coxxs
Copy link
Contributor

@Coxxs Coxxs commented Jul 24, 2022

Bug description:

import { Api } from 'telegram'

// globalPrivacySettings#bea2f424 flags:# archive_and_mute_new_noncontact_peers:flags.0?Bool = GlobalPrivacySettings;

let t1 = new Api.GlobalPrivacySettings({
  archiveAndMuteNewNoncontactPeers: false
})
console.log(t1.getBytes())
// expect: <Buffer 24 f4 a2 be 01 00 00 00 37 97 79 bc>
// actual: <Buffer 24 f4 a2 be 00 00 00 00> ❌

let t2 = new Api.GlobalPrivacySettings({
  flags: 1,
  archiveAndMuteNewNoncontactPeers: false
})
console.log(t2.getBytes())
// expect: <Buffer 24 f4 a2 be 01 00 00 00 37 97 79 bc>
// actual: <Buffer 24 f4 a2 be 00 00 00 00> ❌

let t3 = new Api.GlobalPrivacySettings({

})
console.log(t3.getBytes())
// expect: <Buffer 24 f4 a2 be 00 00 00 00>
// actual: <Buffer 24 f4 a2 be 00 00 00 00> ✔

@painor
Copy link
Member

painor commented Jul 24, 2022

hmm I remember fixing a similar bug a while ago with the same API method. maybe I missed this one.

@painor painor merged commit 865c28e into gram-js:master Jul 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants