Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix view docs link #3882
Good this is fixed now and that you handle a knockout solution! It was hard to me at the beggining :)
Although this solve the issue, I'm not sure that I like the solution. It seems kind of overkill to me and also the response from that endpoint is not always accurate: the first time we hit that enpoint we will have a
docs_url field which is a "lie", I mean, it doesn't point to the docs URL but to the edit version URL.
So, to me, as I said, I think this solves this particular issue but I think we need a general solution that do not potentially affect other uses of this endpoint.
I don't have a better solution from the top of my head but we should think in a better one. Maybe a simple
templatetag that calls
self.project.get_docs_url( version_slug=self.slug, private=private)
is a better/simpler solution.
@humitos there is a
The first calls to the endpoint wouldn't make sense, but this should only be used when the build is completed and marked as successful.
Is this a problem?
This is called every 2s on the build page, so the only call that will make sense is the latest one. But anyway, what I want to avoid is having a endpoint that return non accurate data.
No. The original issue was that this chunk of code was called:
Which generates the link to edit the version.
What I am proposing is to call directly this chunk of code,
that no matter if the Version is built/uploaded or not the link is generated properly. Since, it will be shown only in a success build, there is no problem of getting 404.
I think a more correct solution is to get this information from the API return and use this in the knockout view.
The problem this introduces is having a third or fourth code location where we have similar logic. So, i'm -1 on splitting this up further.
Ups... I told him to use a template tag instead of a call to the API as he has done before and I mentioned a problem that the first solution using the API had at:
Querying to the API while building return a