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

🎨 tidy up static id (owner, internal, external) usages #7675

Merged

Conversation

kirrg001
Copy link
Contributor

@kirrg001 kirrg001 commented Nov 4, 2016

no issue

This PR is an extracted clean up feature of #7495.
We are using everywhere static id checks (userId === 0 or userId === 1).
This PR moves the static values into the Base model.
This makes it 1. way more readable and 2. we can change the id's in a central place.

I changed the most important occurances - no tests are touched (yet!).

The background is: when changing from auto increment id (number) to ObjectId's (string) we still need to support id 1 and 0, because Ghost relies on these two static id's.
I would like to support using both: 0/1 as string and 0/1 as number.

1 === owner/internal
0 === external

Another important change:
User Model does not longer define the contextUser method, because i coulnd't find a reason?
I looked in Git history, see 6e48275

@kirrg001
Copy link
Contributor Author

kirrg001 commented Nov 4, 2016

This PR needs a review before #7495

@kirrg001 kirrg001 changed the title 🎨 tidy up static id (owner, internal, external) usages [WIP] 🎨 tidy up static id (owner, internal, external) usages Nov 9, 2016
@kirrg001 kirrg001 force-pushed the 1.0.0-dev/owner-internal-external-ids branch from 1ef9377 to c450364 Compare November 9, 2016 12:56
@kirrg001 kirrg001 changed the title [WIP] 🎨 tidy up static id (owner, internal, external) usages 🎨 tidy up static id (owner, internal, external) usages Nov 9, 2016
@kirrg001 kirrg001 force-pushed the 1.0.0-dev/owner-internal-external-ids branch from c450364 to a42dcdd Compare November 9, 2016 13:07
no issue

This PR is an extracted clean up feature of TryGhost#7495.
We are using everywhere static id checks (userId === 0 or userId === 1).
This PR moves the static values into the Base model.
This makes it 1. way more readable and 2. we can change the id's in a central place.

I changed the most important occurances - no tests are touched (yet!).

The background is: when changing from auto increment id (number) to ObjectId's (string) we still need to support id 1 and 0, because Ghost relies on these two static id's.
I would like to support using both: 0/1 as string and 0/1 as number.

1 === owner/internal
0 === external

Another important change:
User Model does not longer define the contextUser method, because i coulnd't find a reason?
I looked in Git history, see TryGhost@6e48275
@kirrg001 kirrg001 force-pushed the 1.0.0-dev/owner-internal-external-ids branch from a42dcdd to 94fbceb Compare November 9, 2016 13:13
@ErisDS ErisDS merged commit 48387e4 into TryGhost:master Nov 9, 2016
geekhuyang pushed a commit to geekhuyang/Ghost that referenced this pull request Nov 20, 2016
refs TryGhost#7494, refs TryGhost#7495 

This PR is an extracted clean up feature of TryGhost#7495.
We are using everywhere static id checks (userId === 0 or userId === 1).
This PR moves the static values into the Base model.
This makes it 1. way more readable and 2. we can change the id's in a central place.

I changed the most important occurrences - no tests are touched (yet!).

The background is: when changing from auto increment id (number) to ObjectId's (string) we still need to support id 1 and 0, because Ghost relies on these two static id's.
I would like to support using both: 0/1 as string and 0/1 as number.

1 === owner/internal
0 === external

Another important change:
User Model does not longer define the contextUser method, because i couldn't find a reason?
I looked in Git history, see TryGhost@6e48275
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