Conditions on appearance of webItems not evaluated for Project?

Hey all.

We have an addon implemented using Atlassian Connect. We are trying to show/hide a webItem (a button in project board) by user configuration.

In our json, we have this:

"webItems": [
			{
				"key": "board-links",
				"location": "jira.agile.board.tools",
				"weight": 10,
				"url": "/webpanel",
				"conditions": [
					{
						"condition": "user_is_logged_in"
					},
					{
						"condition": "entity_property_exists",
						"invert": true,
						"params": {
							"entity": "project",
							"propertyKey": "my-addon-disabled"
						}
					},
					{
						"condition": "entity_property_exists",
						"invert": true,
						"params": {
							"entity": "addon",
							"propertyKey": "my-addon-disabled"
						}
					}
				]
			}
		]

When I added a property called “my-addon-disabled” (with any value) to the addon, the webItem disappears. But if I have this property on the Project, nothing happens, as if it’s not evaluated.

Is this a known bug? are there any limitations on the conditions?

Any help is appreciated, thank you for reading my question :saluting_face:

3 Likes

Have you tried changing the entity parameter of the condition to project?

As per the documentation:

entity - the entity on which the property has been stored. If an entity of the expected type is not present in the rendering context of the user interface element, the condition evaluates to false.

  • Common: addon
  • Confluence: content, space
  • Jira: project, issue, user, issuetype, comment, dashboarditem

Hey @remie. Yeah, you can see in the json above. Entity addon works fine, but entity project doesn’t make any difference.

Oh sorry, I missed that part.

Ok, so if I parse the list of conditions correctly, this web item should show if:

`User is logged in` 
AND `project entity my-addon-disabled does not exists` 
AND `addon entity my-addon-disabled does not exists`

Which means that both project property my-addon-disabled as well as addon property my-addon-disabled should not be set in order for the item to show. If either one is set, the web item should not show.

Based on your description, you seem to imply that the web item already disappeared with only setting the addon property my-addon-disabled. Is this correct?

You also say that the web item did not dissapear after you set the project entity my-addon-disabled. May I ask if you removed the addon entity my-addon-disabled prior to testing this?

Because I think that if you set both properties, this condition will indeed evaluate to true (as in, the web item should be shown) because the conditions array is an implicit AND composite condition.

EDIT: I’m thinking out load here, and still trying to make sense of this. I believe there is a situation possible in which the combination of settings can make this condition evaluate true because of the way these conditions work. But I’m having trouble pinpointing it, and thus explaining it.

1 Like

Thanks @remie for helping here.

Even if I remove and keep only 1 condition, the one with entity “project”, it doesn’t work. But if I keep the one with “addon” entity, it works fine.

Could it be that there’s a bug with legacy projects and such conditions? wdyt?

I would not expect it to matter, we’re using conditions extensively, some of them even specifically targeting classic projects. I will try to see if I can recreate this issue in my own apps tomorrow (it’s 10.30pm over here right now). Perhaps this will allow me to formulate what I believe is going wrong here.

2 Likes