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: only the project creator can change their role #960

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

EvanHahn
Copy link
Contributor

(This diff looks large, but it's just one line of source code and a bunch of tests.)

We have some code like this:

if (isAssigningProjectCreatorRole && !this.#isProjectCreator()) {

The intent: only allow the project creator to change their own role.

However, this.#isProjectCreator returned a Promise, which meant that the second part of the condition always evaluated to false, which meant that the whole condition always evaluated to false, which meant that non-creators could change the creator's role.

This fixes that by making #isProjectCreator return a boolean, not Promise<boolean>.

Found this while working on #188.

(This diff looks large, but it's just one line of source code and a
bunch of tests.)

We have some code like this:

```
if (isAssigningProjectCreatorRole && !this.#isProjectCreator()) {
```

The intent: only allow the project creator to change their own role.

However, `this.#isProjectCreator` returned a `Promise`, which meant that
the second part of the condition *always* evaluated to `false`, which
meant that the whole condition always evaluated to false, which meant
that non-creators could change the creator's role.

This fixes that by making `#isProjectCreator` return a `boolean`, not
`Promise<boolean>`.

Found this while working on [#188].

[#188]: #188
@EvanHahn EvanHahn merged commit 9cfdd0c into main Nov 18, 2024
9 checks passed
@EvanHahn EvanHahn deleted the fix-assigning-creator branch November 18, 2024 15:21
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.

2 participants