Skip to content
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

fix: moving slack integration to ee module & improvements #2301

Open
wants to merge 18 commits into
base: slack-integration
Choose a base branch
from

Conversation

huglx
Copy link
Collaborator

@huglx huglx commented May 10, 2024

  • move controllers & business logic to ee module
  • add slack integration to features

@huglx huglx requested a review from JanCizmar May 10, 2024 13:03
@huglx huglx changed the title fix: moving slack integration to ee module fix: moving slack integration to ee module & improvments May 17, 2024
@huglx huglx changed the title fix: moving slack integration to ee module & improvments fix: moving slack integration to ee module & improvements May 17, 2024
@huglx
Copy link
Collaborator Author

huglx commented May 17, 2024

add more updates:

  • Resolved changes from issue #2302

  • Updated message on successful subscription

  • Resolved issue with grouping messages

Copy link
Contributor

@JanCizmar JanCizmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge it after the fixes, but please add more tests testing these changes in next iteration.

import org.hibernate.annotations.Type

@Entity
class SavedSlackMessage(
val messageTs: String,
val messageTs: String = "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is Ts? Please don't use abbreviations, if it's not 100% obvious.

var langTags: Set<String>,
var createdKeyBlocks: Boolean,
) : StandardAuditModel()
var langTags: Set<String> = setOf(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var langTags: Set<String> = setOf(),
var languageTags: Set<String> = setOf(),

import org.hibernate.annotations.ColumnDefault
import org.hibernate.annotations.Type

@Entity
class SlackConfig(
@ManyToOne(fetch = FetchType.LAZY)
var project: Project,
var project: Project = Project(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't set defaults in entity constructors like this, it is unsafe...

@Entity
class SlackMessageInfo(
@ManyToOne(fetch = FetchType.LAZY)
var slackMessage: SavedSlackMessage = SavedSlackMessage(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't provide the default.

class SlackMessageInfo(
@ManyToOne(fetch = FetchType.LAZY)
var slackMessage: SavedSlackMessage = SavedSlackMessage(),
var langTag: String = "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var langTag: String = "",
var languageTag: String = "",

@@ -146,6 +155,8 @@ class SlackSlashCommandController(
languageTag: String?,
optionsMap: Map<String, String>,
): SlackMessageDto? {
// featureEnabled()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed, right?

@@ -231,6 +242,17 @@ class SlackSlashCommandController(
}
}

private fun featureEnabled() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be called checkFeatureEnabled

@@ -231,6 +242,17 @@ class SlackSlashCommandController(
}
}

private fun featureEnabled() {
try {
enabledFeaturesProvider.checkFeatureEnabled(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can use isFeatureEnabled instead of catching generic BRE.

@@ -10,4 +10,6 @@ data class SavedMessageDto(
val langTag: Set<String>,
val createdKeyBlocks: Boolean = false,
val baseChanged: Boolean = false,
// map of langTag and authorContext
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is author context?

@@ -62,18 +61,20 @@ class SlackExecutor(
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above ^^, You should find the saved messages in one request using in operator in one SQL requests instead of iterating like this. Also the property should be named savedMessages and then when you iterate over it you got single savedMessage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants