Skip to content

Commit

Permalink
Issue atlassian-labs#305: revert changes for preventing REST calls as…
Browse files Browse the repository at this point in the history
… they may have unindented impact on other functionality
  • Loading branch information
annapieper committed Jan 22, 2024
1 parent 0140ddd commit 6183806
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ require([
jsCookies
) {
var SLACK_ADMIN_BANNER_COOKIE_KEY = "SLACK_ADMIN_BANNER_DISMISS_2";

AJS.toInit(function () {


if (!isSlackConfigurationPage() && loggedInUser.isAdmin() && !isAlreadyDismissed()
&& (isInIssueView() && isSlackPanelVisible())) {
if (!isSlackConfigurationPage() && loggedInUser.isAdmin() && !isAlreadyDismissed()) {
$.ajax({
url: wrmContextPath() + '/slack/configuration/status',
dataType: 'json',
Expand Down Expand Up @@ -50,12 +46,5 @@ require([
function isAlreadyDismissed() {
return jsCookies.get(SLACK_ADMIN_BANNER_COOKIE_KEY) === "true";
}

function isInIssueView() {
return $('#issue-content').length > 0;
}
function isSlackPanelVisible() {
return $("#slack-issue-panel").length > 0;
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ require([
var flag = null;

$(function () {
// skip if user is already in configuration view or edit pages or in issue view and slack panel isn't shown
// skip if user is already in configuration view or edit pages
if (contains(window.location.pathname, CONFIGURE_PAGE_URL)
|| contains(window.location.pathname, OAUTH_SESSIONS_PAGE_URL)
|| (isInIssueView() && !isSlackPanelVisible())) {
|| contains(window.location.pathname, OAUTH_SESSIONS_PAGE_URL)) {
return;
}

Expand Down Expand Up @@ -65,20 +64,6 @@ require([
});
}

/**
* @returns {boolean} true when using the Slack app in Jira and the content of an issue is shown
*/
function isInIssueView() {
return $('#issue-content').length > 0;
}

/**
* @returns {boolean} true when using the Slack app in Jira and the slack issue panel is shown
*/
function isSlackPanelVisible() {
return $("#slack-issue-panel").length > 0;
}

function contains(str, substr) {
return str.indexOf(substr) !== -1;
}
Expand Down

0 comments on commit 6183806

Please sign in to comment.