BLOG-128 Fix logic for determining published post access based on user login status (#129)
Some checks failed
Frontend CI / build (push) Has been cancelled
Some checks failed
Frontend CI / build (push) Has been cancelled
### Description The relationship between `is_published_only` and `has_logged_in`: | is_published_only | has_logged_in | result | | ----------------- | ------------- | ------ | | T | T | T | | T | F | T | | F | T | F | | F | F | T | ### Package Changes _No response_ ### Screenshots _No response_ ### Reference Resolves #128 ### Checklist - [x] A milestone is set - [x] The related issuse has been linked to this branch Reviewed-on: #129 Co-authored-by: SquidSpirit <squid@squidspirit.com> Co-committed-by: SquidSpirit <squid@squidspirit.com>
This commit is contained in:
parent
a3892f2289
commit
fcada15211
@ -33,7 +33,15 @@ impl GetAllPostInfoUseCase for GetAllPostInfoUseCaseImpl {
|
|||||||
is_published_only: bool,
|
is_published_only: bool,
|
||||||
user_id: Option<i32>,
|
user_id: Option<i32>,
|
||||||
) -> Result<Vec<PostInfo>, PostError> {
|
) -> Result<Vec<PostInfo>, PostError> {
|
||||||
let is_published_only = is_published_only && user_id.is_some();
|
let has_logged_in = user_id.is_some();
|
||||||
|
|
||||||
|
// | is_published_only | has_logged_in | result |
|
||||||
|
// | ----------------- | ------------- | ------ |
|
||||||
|
// | T | T | T |
|
||||||
|
// | T | F | T |
|
||||||
|
// | F | T | F |
|
||||||
|
// | F | F | T |
|
||||||
|
let is_published_only = is_published_only || !has_logged_in;
|
||||||
|
|
||||||
self.post_repository
|
self.post_repository
|
||||||
.get_all_post_info(is_published_only)
|
.get_all_post_info(is_published_only)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user