-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Allow visitors to create posts with tags #1221
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really good - apologies for the slow response in looking at this.
app/actions/post.go
Outdated
func (input *CreateNewPost) OnPreExecute(ctx context.Context) error { | ||
input.Tags = make([]*entity.Tag, len(input.TagSlugs)) | ||
for i, slug := range input.TagSlugs { | ||
getTag := &query.GetTagBySlug{Slug: slug} | ||
if err := bus.Dispatch(ctx, getTag); err != nil { | ||
return err | ||
} | ||
|
||
input.Tags[i] = getTag.Result | ||
} | ||
|
||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to make this part of OnPreExecute. You'll just need to update that comment though.
BaseURL string `env:"BASE_URL"` | ||
Locale string `env:"LOCALE,default=en"` | ||
JWTSecret string `env:"JWT_SECRET,required"` | ||
PostCreationWithTagsEnabled bool `env:"POST_CREATION_WITH_TAGS_ENABLED,default=false"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this looks good. I was contemplating if we should have a nested AppFeatures
struct, and move this into there so that we could add other things in future, but I think we probably don't need to do that...
Looking good. What are you thinking for tests? |
On the action part I'm not sure anything is needed, but tell me if I'm wrong. On the handler part I think the needed tests are :
As of now I think the fails are sent as a 404 error, so I will need to investigate on that before making these tests. |
I suppose it depends - if you're handler tests poke the action then that's great, if they mock the action though then you might need some action tests to check the logic around building up the tags for example - see how you get on 👍 |
I created the tests, the actions are poked and function well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers, yeah this is coming on nicely, there might be more tests as it progresses but no issues here
Co-authored-by: Matt Roberts <[email protected]>
Thanks, i will look into the UI further but I struggle a bit more with this part. I see there are errors on the ui test side, is it normal ? I don't think I made changes on the UI that could trigger these errors but I'm not sure. |
Yeah it looks like something has changed, I think a new playwright version is causing problems for our github actions (microsoft/playwright#30368) - it's nothing you've done. I'll take a look at this |
@MercierMateo Ugh, something went badly wrong in github - I tried to add a commit to your PR and ended up merging it into main - sorry about this. I'll sort it out |
@MercierMateo Ok confession time. I was trying out the What an idiot I am. Sorry. I see 2 options here
What are your thoughts on this, and do you have any other suggestions? Thanks! Matt |
Ok no problem, I'll add this to my list of reasons to avoid using ChatGPT I think option 2 is fine. As I separated my work on the UI from my main branch, only the backend part was merged on your main. I can easily create a new PR and continue working on the UI part of the feature. Obviously if there are any required fixes on the backend part we can go for option 1, but it doesn't seem like it. |
Yes I think this is the best option - it's much easier all round I think, I've just got to sort out the issues causing the build to break on my side, and you can work on the UI. |
Great stuff. I've fixed the issue with the tests failing now.
Matt
…On Tue, Dec 17, 2024 at 12:25 PM MercierMateo ***@***.***> wrote:
Ok no problem, I'll add this to my list of reasons to avoid using ChatGPT
I think option 2 is fine. As I separated my work on the UI from my main
branch, only the backend part was merged on your main. I can easily create
a new PR and continue working on the UI part of the feature.
Obviously if there are any required fixes on the backend part we can go
for option 1, but it doesn't seem like it.
—
Reply to this email directly, view it on GitHub
<#1221 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA2VDFTOX7QE32E7M5YZNL2GAJ3NAVCNFSM6AAAAABR6O4GICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBYGMZDEOBYG4>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Issue: #1211
Visitors can now create post with tags