track-extension icon indicating copy to clipboard operation
track-extension copied to clipboard

Add support for Pull Requests in Bitbucket

Open vedr4n opened this issue 5 years ago • 2 comments

Toggl Button worked with Bitbucket PRs at one point, but it got lost down the line.

Describe the changes you'd like

Add the "Start timer" button to Pull Requests in Bitbucket. Currently, we only display it in issues.

Relevant links or screenshots

This is how it currently looks like (in issues). Do the same in PRs. ec599c36-0078-11e5-8a0c-99d73a9130b3

Slack convo.

Additional context

User request.

vedr4n avatar Sep 16 '20 13:09 vedr4n

I was using the Toggl button in PR's up until today when I switched to the "New PR Experience", and now it's missing. So it's only stopped working since Bitbucket changed things. The "Refined Bitbucket" Chrome extension had the same problem but they've mostly resolved it.

Update: OK, I see. The structure of the page has completely changed, so the Toggl-button plugin can't find an element to hook into. Unfortunately Bitbucket's new CSS classes are the most poorly named things I've ever seen. I don't know whether these are static or if they'll change regularly, but targeting specific elements is going to be pretty challenging: Selection_1799

chrisaligent avatar Dec 22 '20 06:12 chrisaligent

Heya, i was also wondering about bitbucket PRs so i took a minute to look at source and it seems all we need is to find a concrete querySelector to match an element where we want to add the button, right?

If it's the case then document.querySelector('nav li > a[href$="/pull-requests"]').closest('ol') would be sufficient to add the button right after the breadcrumbs, just like it does with Jira issues.

As for the description, i reckon document.querySelector('h1').textContent should do the job too.

I would do a PR but as far as i can tell there no way for me to test locally. Or is there?

tsadiq avatar Jan 21 '25 14:01 tsadiq