Skip to content

Commit

Permalink
Exchange: layouts added from exchange should not have the imported ta…
Browse files Browse the repository at this point in the history
…g, because they are applied templates and the parent tags win. (#2664)

fixes xibosignageltd/xibo-private#811
  • Loading branch information
dasgarner authored Aug 1, 2024
1 parent ca0dfe5 commit c1d1793
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion lib/Controller/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,8 @@ public function applyTemplate(Request $request, Response $response, $id): Respon
$this->getDataSetFactory(),
'',
$this->mediaService,
$layout->folderId
$layout->folderId,
false,
);

$template->managePlaylistClosureTable();
Expand Down
21 changes: 11 additions & 10 deletions lib/Factory/LayoutFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
use Xibo\Helper\DateFormatHelper;
use Xibo\Service\ConfigServiceInterface;
use Xibo\Service\MediaServiceInterface;
use Xibo\Support\Exception\ConfigurationException;
use Xibo\Support\Exception\DuplicateEntityException;
use Xibo\Support\Exception\GeneralException;
use Xibo\Support\Exception\InvalidArgumentException;
Expand Down Expand Up @@ -1252,7 +1251,7 @@ public function loadByJson($layoutJson, $playlistJson, $nestedPlaylistJson, Fold
* @param string $zipFile
* @param string $layoutName
* @param int $userId
* @param int $template
* @param int $template Are we importing a layout to be used as a template?
* @param int $replaceExisting
* @param int $importTags
* @param bool $useExistingDataSets
Expand All @@ -1261,12 +1260,10 @@ public function loadByJson($layoutJson, $playlistJson, $nestedPlaylistJson, Fold
* @param string $tags
* @param MediaServiceInterface $mediaService
* @param int $folderId
* @param bool $isSystemTags Should we add the system tags (currently the "imported" tag)
* @return Layout
* @throws DuplicateEntityException
* @throws GeneralException
* @throws InvalidArgumentException
* @throws NotFoundException
* @throws ConfigurationException
* @throws \FontLib\Exception\FontNotFoundException
* @throws \Xibo\Support\Exception\GeneralException
*/
public function createFromZip(
$zipFile,
Expand All @@ -1280,7 +1277,8 @@ public function createFromZip(
$dataSetFactory,
$tags,
MediaServiceInterface $mediaService,
int $folderId
int $folderId,
bool $isSystemTags = true,
) {
$this->getLog()->debug(sprintf(
'Create Layout from ZIP File: %s, imported name will be %s.',
Expand Down Expand Up @@ -1433,8 +1431,11 @@ public function createFromZip(
$layout->assignTag($this->tagFactory->tagFromString('template'));
}

// Tag as imported
$layout->assignTag($this->tagFactory->tagFromString('imported'));
// Add system tags?
if ($isSystemTags) {
// Tag as imported
$layout->assignTag($this->tagFactory->tagFromString('imported'));
}

// Tag from the upload form
$tagsFromForm = (($tags != '') ? $this->tagFactory->tagsFromString($tags) : []);
Expand Down

0 comments on commit c1d1793

Please sign in to comment.