Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Add-on development: Where can I see the full list of supported conditions?

moigagoo August 12, 2015

Hi!

I'm creating an add-on for Bitbucket and need to show the button in the repo navigation only for certain repos. I can probably do that with conditions, but I can't find the right condition. This page just gives a couple examples, but not a full list: https://developer.atlassian.com/static/bitbucket/concepts/conditions.html

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
abhin-atl
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 2, 2015

Hi Konstantin,

Our documentation is currently getting an over-haul and hence the full list is not included. For a quick band-aid, I will list out all of our conditions. In the future, these conditions will be included in our docs.

has_account_permission

Checks whether the current user has permissions to an account.

{
	"params": {
		"permission": <collaborator|admin>
	}
}

user_is_logged_in

Checks whether the current user is logged in

Valid values: true, false

has_permission

Checks whether the user has a specific permission with a repo.

{
	"params": {
		"permission": <read|write|admin>
	}
}

has_file

This tests whether a certain file exists in a repository. If the "cset" parameter is provided, then the test happens on that specific changeset. If the "cset" parameter is not provided, the test happens on the head of the "main-branch" of the repo (configurable from the repo settings).

{
	"params": {
		"cset": <optional-changeset>,
		"filename": <name-of-file>
	}
}

scm

This tests whether the repository in question is Git or Hg.

{
	"params": {
		"type": <git|hg>
	}
}

is_binary

Tests whether the specific file is binary (this condition is useful for custom file-viewers).

Valid values: true, false

0 votes
Daniel Wester
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2015

There aren't many hidden conditions (I don't think there are any at all). What you're describing is a remote condition. You'd have to do the logic on your side of the application.

moigagoo August 12, 2015

Hi! Thanks for the quick response! As far as I understand, the location of a module is defined strictly in connect.json. I can check the repo name and show specific content inside the app, but I can't check it and hide the module, because the app code is not executed until the module is opened. The app I'm creating adds a storefront to the repo page. The idea is to allow developers sell project merch right from the repo page. This implies that the module's content is different for each repo (can easily be done inside the app) and that the module should be hidden for repos without assigned storefronts (can't be done from inside the app, as far as I know).

TAGS
AUG Leaders

Atlassian Community Events