-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #305: add check if slack panel is visible to prevent unnecessar… #332
base: release-1.x
Are you sure you want to change the base?
Issue #305: add check if slack panel is visible to prevent unnecessar… #332
Conversation
…ent unnecessary REST calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnnaPiper Thank you for the submission!
Please see and address some comments.
@@ -42,7 +42,7 @@ | |||
<atlassian-json-api.version>0.9</atlassian-json-api.version> | |||
<atlassian-concurrent.version>3.0.0</atlassian-concurrent.version> | |||
<commons-codec.version>1.11</commons-codec.version> | |||
<slack.common.version>1.1.13</slack.common.version> | |||
<slack.common.version>1.1.14</slack.common.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Versions of common modules aren't changed in this repo. Please roll back this change here and in other pom.xml
s.
At the very beginning of work on plugin the team tried it, but then stopped. It appeared to be quite error prone and hard to manage that many different versions. Instead we don't publish common packages separately, only as part of a plugin. It makes code reuse between modules easier much. Once a change is done to a common module, just install it with the same version to the local repository and it's ready to be used in other modules.
</parent> | ||
|
||
<groupId>com.atlassian.jira.plugins</groupId> | ||
<artifactId>jira-slack-server-integration-plugin</artifactId> | ||
<packaging>atlassian-plugin</packaging> | ||
<version>3.0.10-SNAPSHOT</version> | ||
<version>3.0.11-SNAPSHOT</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version of the plugin module is updated only on release by Maven Release plugin. Please roll it back.
}); | ||
var $issuePanel = $("#slack-issue-panel"); | ||
if (!issueKey || !$issuePanel.length) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than modifying the whole function to be a no-op, I'd recommend to prevent calling this function altogether. It would be less changes and the logic flow would be clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I basically just added another condition to the already existing one that checks for the issueKey
. Because getTemplate()
is called 2 times it would be more code moving the condition out of the function. But if you want I can do the check before each function call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I agree. Then it may stay as it is.
} | ||
function isSlackPanelVisible() { | ||
return $("#slack-issue-panel").length; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to prevent duplication of these functions in multiple files?
Also, since it isn't Typescript, let's be more strict regarding types. The functions follow Java naming convention for boolean-returning function, so let's convert returned values to booleans to prevent ambiguities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also thought about that duplicated code but I didn't find out how to do it because the two JS files are located in separate apps. Do you have an idea?
Agree on the prevention of ambiguitites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see what you mean. This file is located in the common module, while other 2 ones are in Jira plugin module.
Ok, then some duplication is acceptable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add a comment for these functions mentioning that they are expected to return true
only when they are used in Jira plugin?
This file is also included into Confuence plugin descriptor and will be called there as well. The functions will return false
there always, because there will be no elements with Jira-plugin-specific IDs on a Confluence page. It's better to keep this detail saved in a comment, then to learn it from debugging years later.
@@ -11,9 +11,10 @@ require([ | |||
var flag = null; | |||
|
|||
$(function () { | |||
// skip if user is already in configuration view or edit pages | |||
// skip if user is already in configuration view or edit pages or in issue view without active slack integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording is technically incorrect here. What your meant probably is "or issue panel isn't shown".
…ule; prevent ambiguities in JS
@mvlasovatl I added the requested changes. If you still see problems with the versions let me know or maybe fix them by yourself as you know better where to put which version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix them by yourself
I suspect that's not how contributions work on Github :) Reviewers review, contributors contribute.
I added a couple more minor comments. Please take a look at them too.
@@ -6,7 +6,7 @@ | |||
<parent> | |||
<artifactId>confluence-slack-integration</artifactId> | |||
<groupId>com.atlassian.plugins</groupId> | |||
<version>1.1.13</version> | |||
<version>1.1.14</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry for the confusion. All changes in pom.xml
files in all modules need to be reverted. I just got used to thinking about repository modules as about 2 big groups: plugin and common modules. That's why I left just 2 comments - one comment for each group of changes.
} | ||
function isSlackPanelVisible() { | ||
return $("#slack-issue-panel").length; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add a comment for these functions mentioning that they are expected to return true
only when they are used in Jira plugin?
This file is also included into Confuence plugin descriptor and will be called there as well. The functions will return false
there always, because there will be no elements with Jira-plugin-specific IDs on a Confluence page. It's better to keep this detail saved in a comment, then to learn it from debugging years later.
Closer review revealed that only change in
Code in |
Thanks for the information. Let me know when you discussed it and came to a decision. I reverted the changes as requested. |
… they may have unindented impact on other functionality
No description provided.