- Strip search term before searching
- order messages by created_at desc
- order contacts by last_activity_at desc
- order conversations by created_at desc
- Search only resolved contacts
- Optimize resolved contacts query
ref: #6583
By default, Rails does not set a timeout on database statements. For example, this will run for a full day, even if your ruby process goes away. But it's configurable in the database.yml with the statement_timeout variable.
Hence we are enforcing a 14s timeout by default. Migration commands inside chatwoot will run with a 10 minutes timeout. For specific cases like migrations, we can override this timeout using the environment variable POSTGRES_STATEMENT_TIMEOUT while starting a new rails console.
Test the timeouts from the rails console using.
```
ActiveRecord::Base.connection.execute("SELECT pg_sleep(15);")
```
ref: https://github.com/ankane/the-ultimate-guide-to-ruby-timeouts#postgresql
ref: https://til.hashrocket.com/posts/b44baf657d-railspg-statement-timeout-
Fixes: chatwoot/product#796
This migration adds a trigram index to the tags table on the name column. This is used to speed up the search for tags by name, this is a heavy sub-query when generating reports where labels are involved.
Trigram indexes are used to speed up LIKE queries; they are not used for equality queries. This is because the index is not a btree index, it is a GIN index. This means that the index is not ordered and so cannot be used for equality queries.
Read more: https://www.postgresql.org/docs/current/pgtrgm.html
The index is created concurrently: https://thoughtbot.com/blog/how-to-create-postgres-indexes-concurrently-in
---------
Co-authored-by: Sojan <sojan@pepalo.com>
* feat: add heatmap component
* feat: add heatmap component
* feat: add dummy heatmap
* refactor: compact tiles
* feat: allow hour
* feat: wire up heatmap query
* feat: allow arbritrary number of weeks
* feat: update position of the widget
* chore: update heatmap title
* refactor: move traffic heatmap to overview
* chore: add comment for perf
* feat: add reconcile logic for heatmap fetching
Fetching the data for the last 6 days all the time is wasteful
So we fetch only the data for today and reconcile it with the data we already have
* refactor: re-org code for new utils
* feat: add translations
* feat: translate days of the week
* chore: update chatwoot utils
* feat: add markers to heatmap
* refactor: update class names
* refactor: move flatten as a separate method
* test: Heatmap Helpers
* chore: add comments
* refactor: method naming
* refactor: use heatmap-level mixin
* refactor: cleanup css
* chore: remove log
* refactor: reports.js to use object instead of separate params
* refactor: report store to use new API design
* refactor: rename HeatmapHelper -> ReportsDataHelper
* refactor: separate clampDataBetweenTimeline
* feat: add tests
* fix: group by hour
* feat: add scroll for smaller screens
* refactor: add base data to reconcile with
* fix: tests
* fix: overflow only on smaller screens
* feat: translate tooltip
* refactor: simplify reconcile
* chore: add docs
* chore: remoev heatmap from account report
* feat: let Heatmap handle loading state
* chore: Apply suggestions from code review
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
* feat: update css
* refactor: color assignment to range
* feat: add short circuit
* Update app/javascript/dashboard/routes/dashboard/settings/reports/components/Heatmap.vue
---------
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
* chore: Use markdown-it instead of marked
* Adds styling for markdown rendered content
* fixes codeclimate issue
* Fixes blockquote styles for widget in darkmode
* fix: issue block quote color issue in light mode
* fix: issue block quote color issue in light mode
* Fixes blockquote color in dark mode
* Remove usage of dark mode mixin in user bubble
* chore: code clean up
---------
Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: iamsivin <iamsivin@gmail.com>