Move admin flag from person to local_user (fixes #3060)#3403
Merged
dessalines merged 11 commits intomainfrom Aug 24, 2023
Merged
Move admin flag from person to local_user (fixes #3060)#3403dessalines merged 11 commits intomainfrom
dessalines merged 11 commits intomainfrom
Conversation
The person table is for federated data, but admin flag can only apply to local users. Thats why it really belongs in the local_user table. This will also prevent the federation code from accidentally overwriting the admin flag
Member
Author
|
This is not a breaking change, the API is unchanged. |
dessalines
reviewed
Jul 3, 2023
Nutomic
commented
Jul 4, 2023
| let added = data.added; | ||
| let added_person_id = data.person_id; | ||
| let added_admin = Person::update( | ||
| let target = LocalUserView::read_person(context.pool(), data.person_id).await?; |
Member
Author
There was a problem hiding this comment.
If its a breaking change anyway I might as well change these data.person_id to data.local_user_id to avoid unnecessary db reads.
Member
There was a problem hiding this comment.
Yeah, might as well do this change across the board. Might mean fewer DB calls.
Member
Author
|
Resolved conflicts. For some reason api tests are failing with this error, no idea why: |
Member
|
I'll test it out now |
Member
|
The admin column on the source table was in the wrong order. It needs to match the order in schema.rs. This was hard to find because they were both boolean columns. |
dessalines
approved these changes
Aug 2, 2023
Member
|
This test started failing all the sudden. I don't understand why its suddenly unable to resolve a banned person. |
a43be04 to
8554465
Compare
Bazsalanszky
pushed a commit
to Bazsalanszky/Eternity
that referenced
this pull request
Oct 6, 2023
… of Lemmy See: LemmyNet/lemmy#3403 For now, I guess we can try parsing the flag if it's present, and fall back on assuming the associated user is *not* an admin.
Bazsalanszky
pushed a commit
to Bazsalanszky/Eternity
that referenced
this pull request
Oct 19, 2023
… of Lemmy See: LemmyNet/lemmy#3403 For now, I guess we can try parsing the flag if it's present, and fall back on assuming the associated user is *not* an admin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The person table is for federated data, but admin flag can only apply to local users. Thats why it really belongs in the local_user table. This will also prevent the federation code from accidentally overwriting the admin flag