Commit e5ef210e authored by Lisa Seeto's avatar Lisa Seeto
Browse files

Bug 1897829: Choosing details in image gallery opens a blank modal



 - check if artefact isset
 - only pass through artefactid if it exists

Change-Id: I65f70a7fffffd938646bac257cc0a461514115a2
Signed-off-by: default avatarLisa Seeto <lisaseeto@catalyst.net.nz>
parent 87e202ef
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -238,8 +238,11 @@ function open_modal(e) {
    var block = $('#configureblock');

    var params = {
        'viewid': viewid,
        'artefactid': $(e.target).closest('a').data('artefactid'),
        'viewid': viewid
    }

    if ($(e.target).closest('a').data('artefactid')) {
        params['artefactid'] = $(e.target).closest('a').data('artefactid');
    }

    if ($(e.target).closest('a').data('blockid') != null) {
+2 −2
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ else {
    $html .= $rendered['html'];

    // Get any existing comments for display
    if ($artefact->get('allowcomments')) {
    if (isset($artefact) && $artefact->get('allowcomments')) {
        $commentoptions = ArtefactTypeComment::get_comment_options();
        $commentoptions->view = $view;
        $commentoptions->artefact = $artefact;
@@ -115,7 +115,7 @@ else {
        $html .= $smarty->fetch('blocktype:comment:comment.tpl');
    }

    if ($artefact->get('allowcomments') && ( $USER->is_logged_in() || (!$USER->is_logged_in() && get_config('anonymouscomments')))) {
    if (isset($artefact) && $artefact->get('allowcomments') && ( $USER->is_logged_in() || (!$USER->is_logged_in() && get_config('anonymouscomments')))) {
        $tmpview = new View($viewid);
        $commenttype = $tmpview->user_comments_allowed($USER);
        $moderate = !$USER->is_logged_in() || (isset($commenttype) && $commenttype === 'private');