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

Add field to all content response DTOs: canAuthUserModerate #1043

Merged
merged 6 commits into from
Aug 20, 2024

Conversation

BentiGorlich
Copy link
Member

  • All content response DTOs (entry, entry_comment, post, post_comment) now have a field canLoggedInUserModerate which indicates whether the loggedin user can moderate said content

Link #1001

- All content response DTOs (entry, entry_comment, post, post_comment) now have a field `canLoggedInUserModerate` which indicates whether the loggedin user can moderate said content
@BentiGorlich BentiGorlich added enhancement New feature or request backend Backend related issues and pull requests api API related issues and pull requests labels Aug 19, 2024
@BentiGorlich BentiGorlich requested a review from jwr1 August 19, 2024 17:40
@BentiGorlich BentiGorlich self-assigned this Aug 19, 2024
@jwr1
Copy link
Member

jwr1 commented Aug 19, 2024

Just a tiny change, but would you be able to change the field name to canAuthUserModerate (can authenticated user moderate)? It's not too big a deal, but IMO, it sounds better than canLoggedInUserModerate. If you think it sounds better as it is, feel free to leave it alone though.

@BentiGorlich BentiGorlich changed the title Add field to all content response DTOs: canLoggedInUserModerate Add field to all content response DTOs: canAuthUserModerate Aug 19, 2024
@BentiGorlich
Copy link
Member Author

done

Copy link
Member

@jwr1 jwr1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested it out, and it looks like canAuthUserModerate is null if it's not a first level comment. Here's an example you can look at (comments I can mod have "CAN MOD" next to them, it should be all of them though):

image

Different example API response just in case:

{"items":[{"commentId":2443650,"user":{"userId":3,"username":"jwr1","isBot":false,"isFollowedByUser":false,"isFollowerOfUser":false,"isBlockedByUser":false,"avatar":{"filePath":"8c\/ed\/8ced191f89b7ac9f3324e7ccffded73e52191b5a74583dece7e59b32986c7727.png","sourceUrl":"https:\/\/media.kbin.social\/media\/8c\/ed\/8ced191f89b7ac9f3324e7ccffded73e52191b5a74583dece7e59b32986c7727.png","storageUrl":"https:\/\/media.kbin.earth\/8c\/ed\/8ced191f89b7ac9f3324e7ccffded73e52191b5a74583dece7e59b32986c7727.png","altText":null,"width":512,"height":512,"blurHash":"LDF=2Y000i^i3rD$}X-p0g%2-nIp"},"apId":null,"apProfileId":null,"createdAt":"2023-12-20T20:56:35+00:00"},"magazine":{"magazineId":4,"name":"kbinEarth","icon":{"filePath":"da\/5a\/da5a4a142adbdb264772760f11e51ba35c200cdad41c92c882877e8fd41ea163.png","sourceUrl":null,"storageUrl":"https:\/\/media.kbin.earth\/da\/5a\/da5a4a142adbdb264772760f11e51ba35c200cdad41c92c882877e8fd41ea163.png","altText":null,"width":512,"height":512,"blurHash":"L73-Uhp2UbejZLaHksktUbf5l.aw"},"isUserSubscribed":true,"isBlockedByUser":false,"apId":null,"apProfileId":"http:\/\/kbin.earth\/m\/kbinEarth"},"entryId":267576,"parentId":null,"rootId":null,"image":null,"body":"I think I figured out the issue. Could anyone who\u0027s noticed their stuff not federating try to repost and make sure it works correctly?","lang":"en","isAdult":false,"uv":0,"dv":0,"favourites":1,"isFavourited":false,"userVote":0,"visibility":"visible","apId":null,"mentions":[],"tags":[],"createdAt":"2024-08-19T03:04:20+00:00","editedAt":null,"lastActive":"2024-08-19T10:42:30+00:00","childCount":1,"children":[{"commentId":2446959,"user":{"userId":123787,"username":"celeste","isBot":false,"isFollowedByUser":false,"isFollowerOfUser":true,"isBlockedByUser":false,"avatar":{"filePath":"5f\/a0\/5fa08ff78bfd76f3ecfb6a5c2c194ba554f8f0042a9da8384ec67236191724a2.jpg","sourceUrl":"https:\/\/media.kbin.social\/media\/5f\/a0\/5fa08ff78bfd76f3ecfb6a5c2c194ba554f8f0042a9da8384ec67236191724a2.jpg","storageUrl":"https:\/\/media.kbin.earth\/5f\/a0\/5fa08ff78bfd76f3ecfb6a5c2c194ba554f8f0042a9da8384ec67236191724a2.jpg","altText":null,"width":1080,"height":1619,"blurHash":"LEDl==%N00aeaeRja#oe00WA~pt7"},"apId":null,"apProfileId":null,"createdAt":"2024-05-11T18:21:06+00:00"},"magazine":{"magazineId":4,"name":"kbinEarth","icon":{"filePath":"da\/5a\/da5a4a142adbdb264772760f11e51ba35c200cdad41c92c882877e8fd41ea163.png","sourceUrl":null,"storageUrl":"https:\/\/media.kbin.earth\/da\/5a\/da5a4a142adbdb264772760f11e51ba35c200cdad41c92c882877e8fd41ea163.png","altText":null,"width":512,"height":512,"blurHash":"L73-Uhp2UbejZLaHksktUbf5l.aw"},"isUserSubscribed":true,"isBlockedByUser":false,"apId":null,"apProfileId":"http:\/\/kbin.earth\/m\/kbinEarth"},"entryId":267576,"parentId":2443650,"rootId":2443650,"image":null,"body":"It looks like comments are federating again for me!","lang":"en","isAdult":false,"uv":0,"dv":0,"favourites":2,"isFavourited":true,"userVote":0,"visibility":"visible","apId":null,"mentions":["@jwr1"],"tags":[],"createdAt":"2024-08-19T10:42:30+00:00","editedAt":null,"lastActive":"2024-08-19T10:42:30+00:00","childCount":0,"children":[],"canAuthUserModerate":null}],"canAuthUserModerate":true}],"pagination":{"count":1,"currentPage":1,"maxPage":1,"perPage":15}}

@BentiGorlich
Copy link
Member Author

I updated the PR :)

@jwr1
Copy link
Member

jwr1 commented Aug 19, 2024

It looks like it is fixed for entry comments, but the issue still exists with post (microblog) comments.

@BentiGorlich
Copy link
Member Author

BentiGorlich commented Aug 19, 2024 via email

@BentiGorlich
Copy link
Member Author

Done

Copy link
Member

@jwr1 jwr1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tried this also, looks good to me!

@BentiGorlich BentiGorlich enabled auto-merge (squash) August 20, 2024 14:03
@BentiGorlich BentiGorlich merged commit 194cbe3 into main Aug 20, 2024
7 checks passed
@BentiGorlich BentiGorlich deleted the new/api-can-user-moderate branch August 20, 2024 14:05
@jwr1 jwr1 mentioned this pull request Aug 20, 2024
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api API related issues and pull requests backend Backend related issues and pull requests enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants