Skip to content

Commit

Permalink
revert tag loading changes and update file
Browse files Browse the repository at this point in the history
reverting commits from c117673 to 4985f67, and ed76601
  • Loading branch information
hinanaya committed Jul 1, 2024
1 parent 2311e2c commit af0d5a6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
3 changes: 1 addition & 2 deletions js/media/addedit.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,7 @@ OB.Media.editPage = function(ids)
$.each(OB.Settings.media_metadata, function(index, metadata)
{
if(metadata.type=='tags') {
// TODO: Tags not currently working.
// $form.find('.metadata_'+metadata.name+'_field').val( media['metadata_'+metadata.name].split(',') );
$form.find('.metadata_'+metadata.name+'_field').val( media['metadata_'+metadata.name].split(',') );
}
else $form.find('.metadata_'+metadata.name+'_field').val( media['metadata_'+metadata.name] );
});
Expand Down
8 changes: 1 addition & 7 deletions models/media_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,6 @@ public function get_init_what($args = [])
$default = implode(',', $default);
}

if ($metadata_field['type'] === 'tags') {
// $this->db->what('GROUP_CONCAT(media_tags.tag)', 'metadata_' . $metadata_field['name'], false);
// var_dump($metadata_field['id']); die();
continue;
}

$this->db->what('COALESCE(media.metadata_' . $metadata_field['name'] . ',"' . $this->db->escape($default) . '")', 'metadata_' . $metadata_field['name'], false);
}
}
Expand All @@ -281,7 +275,6 @@ public function get_init_join($args = [])
$this->db->leftjoin('languages', 'media.language', 'languages.language_id');
$this->db->leftjoin('countries', 'media.country', 'countries.country_id');
$this->db->leftjoin('media_genres', 'media.genre_id', 'media_genres.id');
//$this->db->leftjoin('media_tags', 'media_tags.media_id', 'media.id');
$this->db->leftjoin('users', 'media.owner_id', 'users.id');
}

Expand Down Expand Up @@ -1407,6 +1400,7 @@ public function save($args = [])
}
}
}
$metadata['metadata_' . $metadata_field['name']] = implode(',', $tags);
} else {
$metadata['metadata_' . $metadata_field['name']] = $item['metadata_' . $metadata_field['name']] ?? null;
}
Expand Down
2 changes: 1 addition & 1 deletion models/mediametadata_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function save($data, $id)
$this->db->query('ALTER TABLE ' . $this->db->format_backticks('media') . ' ADD ' . $this->db->format_backticks('metadata_' . $data['name']) . ' BOOLEAN NULL DEFAULT NULL');
} elseif ($save['type'] == 'select' || $save['type'] == 'text') {
$this->db->query('ALTER TABLE ' . $this->db->format_backticks('media') . ' ADD ' . $this->db->format_backticks('metadata_' . $data['name']) . ' VARCHAR(255) NULL DEFAULT NULL');
} elseif ($save['type'] == 'textarea') {
} elseif ($save['type'] == 'textarea' || $save['type'] == 'tags') {
$this->db->query('ALTER TABLE ' . $this->db->format_backticks('media') . ' ADD ' . $this->db->format_backticks('metadata_' . $data['name']) . ' TEXT NULL DEFAULT NULL');
} elseif ($save['type'] == 'integer') {
$this->db->query('ALTER TABLE ' . $this->db->format_backticks('media') . ' ADD ' . $this->db->format_backticks('metadata_' . $data['name']) . ' BIGINT NULL DEFAULT NULL');
Expand Down
2 changes: 1 addition & 1 deletion updates/20240321.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function run()
$colType = 'VARCHAR(255)';
break;
case 'tags':
// Tags are stored in media_tags table.
$colType = 'TEXT';
break;
case 'hidden':
$colType = 'LONGTEXT';
Expand Down

0 comments on commit af0d5a6

Please sign in to comment.