Closed
Bug 627359
Opened 13 years ago
Closed 13 years ago
get_object_fallback needs to be redirect-aware
Categories
(support.mozilla.org :: Knowledge Base Software, task, P1)
support.mozilla.org
Knowledge Base Software
Tracking
(Not tracked)
VERIFIED
FIXED
2.4.3
People
(Reporter: jsocol, Assigned: erik)
References
Details
(I know this makes get_object_fallback particularly complex. I'll file a CQ bug to address that next.)
In get_object_fallback, we need an extra case, essentially in here:
> if hasattr(fallback, 'translated_to'):
> trans = fallback.translated_to(locale)
> if trans and trans.current_revision:
> return trans
> --> RIGHT HERE
We need to check fallback.content to see if it's a redirect, and if so, check that the target article has been localized. In pseudocode:
if fallback.content.startswith('REDIRECT'):
target = get_redirect_target(fallback.content)
if target.exists()
trans = target.translated_to(locale)
if trans and trans.current_revision:
return trans
I don't think we should return target if the trans doesn't exist, but I'm open to arguments for or against that.
Assignee | ||
Comment 1•13 years ago
|
||
The test for whether the doc is a redirect belongs in the Document model. Perhaps Document.redirect_url() suffices; perhaps not.
Reporter | ||
Comment 2•13 years ago
|
||
That sounds like volunteering => Erik. I agree that this belongs on the model, but it shouldn't require schema changes.
Assignee: nobody → erik
Assignee | ||
Comment 3•13 years ago
|
||
Landed in http://github.com/jsocol/kitsune/commit/fe593fb.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment 4•13 years ago
|
||
Please add QA steps or [qa-], thanks
Assignee | ||
Comment 5•13 years ago
|
||
From the commit message: "This means that, for example, if you have Document D in Deutsch which links to [[A]], A is a redirect to B, and B has a Deutsch translation Bd, rendering D will give you a link straight to Bd. That's about as simple as it gets, I'm afraid, but it's really handy when English articles get renamed and tranlations linked straight to the English."
Comment 6•13 years ago
|
||
Took me a while, but I verified this. Sorry I missed the checkin notes.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•