Don't show empty item detail page for disabled mod
When a mod is disabled, a naïve search for the item will yield an empty set. Instead, ignore whether a mod is disabled when looking for the principle item for a given page.
This commit is contained in:
@@ -206,7 +206,7 @@ module.exports = class ItemPageController extends PageController
|
|||||||
@_videoControllers ?= []
|
@_videoControllers ?= []
|
||||||
index = 0
|
index = 0
|
||||||
|
|
||||||
videos = @model?.item.videos or []
|
videos = @model?.item?.videos or []
|
||||||
if videos? and videos.length > 0
|
if videos? and videos.length > 0
|
||||||
@$videosSection.slideDown duration:Duration.normal
|
@$videosSection.slideDown duration:Duration.normal
|
||||||
@$videosSectionTitle.html if videos.length is 1 then 'Video' else 'Videos'
|
@$videosSectionTitle.html if videos.length is 1 then 'Video' else 'Videos'
|
||||||
@@ -231,7 +231,7 @@ module.exports = class ItemPageController extends PageController
|
|||||||
_resolveItemSlug: ->
|
_resolveItemSlug: ->
|
||||||
return if @model.item?
|
return if @model.item?
|
||||||
|
|
||||||
item = @modPack.findItem @_itemSlug, includeDisabled:false
|
item = @modPack.findItem @_itemSlug, includeDisabled:true
|
||||||
if item?
|
if item?
|
||||||
if not ItemSlug.equal item.slug, @_itemSlug
|
if not ItemSlug.equal item.slug, @_itemSlug
|
||||||
router.navigate Url.item(modSlug:item.slug.mod, itemSlug:item.slug.item), trigger:true
|
router.navigate Url.item(modSlug:item.slug.mod, itemSlug:item.slug.item), trigger:true
|
||||||
|
|||||||
Reference in New Issue
Block a user