mirror of https://github.com/MISP/MISP
fix: [eventReport:markdownEditor] Avoid override of legitimate tags if
they don't have data linked to thempull/6412/head
parent
0780d9a088
commit
5ecd3b7236
|
@ -1158,20 +1158,26 @@ class TagsController extends AppController
|
|||
if (!$searchIfTagExists && empty($tags)) {
|
||||
$tags = [];
|
||||
foreach ($tag as $i => $tagName) {
|
||||
$tags[] = ['Tag' => ['name' => $tagName]];
|
||||
$tags[] = ['Tag' => ['name' => $tagName], 'simulatedTag' => true];
|
||||
}
|
||||
}
|
||||
$this->loadModel('Taxonomy');
|
||||
foreach ($tags as $k => $t) {
|
||||
$dataFound = false;
|
||||
$taxonomy = $this->Taxonomy->getTaxonomyForTag($t['Tag']['name'], false);
|
||||
if (!empty($taxonomy)) {
|
||||
$dataFound = true;
|
||||
$tags[$k]['Taxonomy'] = $taxonomy['Taxonomy'];
|
||||
$tags[$k]['TaxonomyPredicate'] = $taxonomy['TaxonomyPredicate'][0];
|
||||
}
|
||||
$cluster = $this->GalaxyCluster->getCluster($t['Tag']['name']);
|
||||
if (!empty($cluster)) {
|
||||
$dataFound = true;
|
||||
$tags[$k]['GalaxyCluster'] = $cluster['GalaxyCluster'];
|
||||
}
|
||||
if (!$searchIfTagExists && !$dataFound && !empty($t['simulatedTag'])) {
|
||||
unset($tags[$k]);
|
||||
}
|
||||
}
|
||||
return $this->RestResponse->viewData($tags, $this->response->type());
|
||||
}
|
||||
|
|
|
@ -612,7 +612,7 @@ function attachTagInfo($elem, eventid, elementID) {
|
|||
}
|
||||
if (tagData === undefined) {
|
||||
tagData = {}
|
||||
$tag = constructTagHtml(elementID, 'white')
|
||||
$tag = constructTagHtml(elementID, '#ffffff', {'border': '1px solid #000'})
|
||||
} else {
|
||||
$tag = getTagReprensentation(tagData)
|
||||
proxyMISPElements['tag'][elementID] = tagData
|
||||
|
@ -868,8 +868,10 @@ function constructTagHtml(tagName, tagColour, additionalCSS) {
|
|||
}
|
||||
|
||||
function constructClusterTagHtml(tagData) {
|
||||
var addBorder = false
|
||||
if (tagData.Tag.colour === undefined) {
|
||||
tagData.Tag.colour = '#ffffff'
|
||||
addBorder = true
|
||||
}
|
||||
var $tag = $('<span/>').append(
|
||||
$('<i/>').addClass('fa fa-' + tagData.GalaxyCluster.Galaxy.icon).css('margin-right', '5px'),
|
||||
|
@ -880,6 +882,7 @@ function constructClusterTagHtml(tagData) {
|
|||
'background-color': tagData.Tag.colour,
|
||||
'color': getTextColour(tagData.Tag.colour),
|
||||
'box-shadow': '3px 3px 3px #888888',
|
||||
'border': (addBorder ? '1px solid #000' : 'none')
|
||||
})
|
||||
return $tag
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue