-
Notifications
You must be signed in to change notification settings - Fork 455
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 bool logic for inCall flag #1233
Fix bool logic for inCall flag #1233
Conversation
nickvergessen
commented
Oct 2, 2018
•
edited
Loading
edited
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it's not strictly required (the check is actually int-number & Participant::FLAG_IN_CALL !== 0
), it's better to explicitly add brackets so lgtm.
Could you please also change it here for consistency:
spreed/js/views/callinfoview.js
Line 89 in 3be5665
isInCall: this.model.get('participantFlags') & OCA.SpreedMe.app.FLAG_IN_CALL !== 0, |
Should be
(this.model.get('participantFlags') & OCA.SpreedMe.app.FLAG_IN_CALL) !== 0
.
Well for the flag with 1 it works the same way, yes. But if you check flag 2 it fails: var_dump(true & 2 !== 0); // int(1)
var_dump((true & 2) !== 0); // bool(false)
var_dump(true & (2 !== 0)); // int(1) the problem is, that php first evaluates !== and then & if there are no brackets |
Signed-off-by: Joas Schilling <coding@schilljs.com>
fa87b8b
to
e4f6aae
Compare
its the same in js, so fixed it there too: console.log(true & 1 !== 0);
console.log((true & 1) !== 0);
console.log(true & (1 !== 0));
1
true
1 |
The first variable in your checks is a number (i.e. the flags), not |
makes no difference: var_dump(1 & 2 !== 0); // int(1)
var_dump((1 & 2) !== 0); // bool(false)
var_dump(1 & (2 !== 0)); // int(1) |
You are right. I was testing the other way round ( |
Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.16.0 to 2.17.1. <details> <summary>Changelog</summary> *Sourced from [eslint-plugin-import's changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md).* > ## [2.17.1] - 2019-04-13 > > ### Fixed > - require v2.4 of `eslint-module-utils` ([#1322]) > > ## [2.17.0] - 2019-04-13 > > ### Added > - Autofixer for [`no-duplicates`] rule ([#1312], thanks [@​lydell]) > - [`no-useless-path-segments`]: Add `noUselessIndex` option ([#1290], thanks [@​timkraut]) > - [`no-duplicates`]: Add autofix ([#1312], thanks [@​lydell]) > - Add [`no-unused-modules`] rule ([#1142], thanks [@​rfermann]) > - support export type named exports from typescript ([#1304], thanks [@​bradennapier] and [@​schmod]) > > ### Fixed > - [`order`]: Fix interpreting some external modules being interpreted as internal modules ([#793], [#794] thanks [@​ephys]) > - allow aliases that start with @ to be "internal" ([#1293], [#1294], thanks [@​jeffshaver]) > - aliased internal modules that look like core modules ([#1297], thanks [@​echenley]) > - [`namespace`]: add check for null ExportMap ([#1235], [#1144], thanks [@​ljqx]) > - [ExportMap] fix condition for checking if block comment ([#1234], [#1233], thanks [@​ljqx]) > - Fix overwriting of dynamic import() CallExpression ([`no-cycle`], [`no-relative-parent-import`], [`no-unresolved`], [`no-useless-path-segments`]) ([#1218], [#1166], [#1035], thanks [@​vikr01]) > - [`export`]: false positives for typescript type + value export ([#1319], thanks [@​bradzacher]) > - [`export`]: Support typescript namespaces ([#1320], [#1300], thanks [@​bradzacher]) > > ### Docs > - Update readme for Typescript ([#1256], [#1277], thanks [[@​kirill](https://github.com/kirill)-konshin]) > - make rule names consistent ([#1112], thanks [@​feychenie]) > > ### Tests > - fix broken tests on master ([#1295], thanks [@​jeffshaver] and [@​ljharb]) > - [`no-commonjs`]: add tests that show corner cases ([#1308], thanks [@​TakeScoop]) </details> <details> <summary>Commits</summary> - [`b0c5e1a`](import-js/eslint-plugin-import@b0c5e1a) bump to v2.17.1 - [`f6716ad`](import-js/eslint-plugin-import@f6716ad) [fix] require v2.4 of `eslint-module-utils` - [`5124dde`](import-js/eslint-plugin-import@5124dde) [utils] v2.4.0 - [`0499050`](import-js/eslint-plugin-import@0499050) bump to v2.17.0 - [`f479635`](import-js/eslint-plugin-import@f479635) [webpack] v0.11.1 - [`8a4226d`](import-js/eslint-plugin-import@8a4226d) Merge pull request [#1320](https://github-redirect.dependabot.com/benmosher/eslint-plugin-import/issues/1320) from bradzacher/export-ts-namespaces - [`988e12b`](import-js/eslint-plugin-import@988e12b) fix(export): Support typescript namespaces - [`70c3679`](import-js/eslint-plugin-import@70c3679) [docs] make rule names consistent - [`6ab25ea`](import-js/eslint-plugin-import@6ab25ea) [Tests] skip a TS test in eslint < 4 - [`405900e`](import-js/eslint-plugin-import@405900e) [Tests] fix tests from [#1319](https://github-redirect.dependabot.com/benmosher/eslint-plugin-import/issues/1319) - Additional commits viewable in [compare view](import-js/eslint-plugin-import@v2.16.0...v2.17.1) </details> <br /> [](https://dependabot.com/compatibility-score.html?dependency-name=eslint-plugin-import&package-manager=npm_and_yarn&previous-version=2.16.0&new-version=2.17.1) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Automerge options (never/patch/minor, and dev/runtime dependencies) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired) Finally, you can contact us by mentioning @dependabot. </details>