-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 6.0.12 EE, 6.1.20 EE GA2, 6.1.30 EE GA3, 6.2.0 CE B3
-
Fix Version/s: 6.2.0 CE RC1
-
Component/s: Tags
-
Story Points:4
-
Fix Priority:4
-
Git Pull Request:
== Steps to reproduce
1- Create a Tag calleg "GT" under Global scope
2- Add an arbitrary property to this tag
3- Switch to Liferay scope
4- Go to Admin/Site Administration/Content/Web Content
5- Create a new WC & tag it with GT >>> Save
6- Go to Tags under Liferay scope
Issue Note, that GT has been created under Liferay scope, but its property has not.
=== Expected behavior
Properties should be also preserved in the new scope Group.
=== Background
AssetEntryLocalServiceImpl#updateEntry
// from line 657 | liferay-portal-6.2.x - 628f8f93f4941c0e6e2accbea919e5badad4faa4 if (tagNames != null) { long siteGroupId = PortalUtil.getSiteGroupId(groupId); List<AssetTag> tags = new ArrayList<AssetTag>(tagNames.length); for (String tagName : tagNames) { AssetTag tag = null; try { tag = assetTagLocalService.getTag(siteGroupId, tagName); } catch (NoSuchTagException nste) { ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setScopeGroupId(siteGroupId); tag = assetTagLocalService.addTag( user.getUserId(), tagName, PropsValues.ASSET_TAG_PROPERTIES_DEFAULT, serviceContext); } if (tag != null) { tags.add(tag); } }
So, here, we try to retrieve the tag, based on its name and the scopeGroupId. However, when the tag comes from Global scope, it will remain NULL after the assetTagLocalService.getTag(siteGroupId, tagName);.
And as we can see, we populate the new tag with default data only within the catch() block.