-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Feature: Slack integration #783
Conversation
# Conflicts: # .env.example # Gemfile.lock # app/models/account.rb # db/schema.rb # spec/rails_helper.rb
# Conflicts: # Gemfile.lock # db/schema.rb
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.
LGTM
@@ -0,0 +1,5 @@ | |||
class AddReferenceIdToConversation < ActiveRecord::Migration[6.0] | |||
def change | |||
add_column :conversations, :reference_id, :string |
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.
@subintp since this attribute will only be used in only x % of conversations lets make use of the additional_attributes
jsonb column to store the reference id. probably let's name it as 'slack_reference_id` to avoid confusion in the future.
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.
@sojan-official Please check the below comment.
Let's go get it guys =) Highly needed. |
end | ||
|
||
def conversation | ||
@conversation ||= Conversation.where(reference_id: params[:event][:thread_ts]).first |
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.
@sojan-official We are fetching the conversation with reference_id to create the new incoming messages from slack.This is the only identifier slack is giving us. We are finding conversation directly by querying it via reference_id. If we move reference_id to addtional_attributes JSONb column we won't able to fetch it with a single query and also looping all conversation and checking for reference_id is not a good approach and also super slow to fetch.
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.
@sojan-official
Update: It's possible to index the JSONb field. But as discussed I am keeping this as separate, But renamed it to identifier to keep it consistant across the models.
# Conflicts: # config/initializers/00_init.rb # config/routes.rb
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Pull Request Template
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: