Commit Graph

4154 Commits

Author SHA1 Message Date
Fayaz Ahmed
b474929f5e chore: Replace eventBus with mitt.js [CW-3275] (#9539)
# Replace the deprecated `eventBus` with mitt.js

## Description

Since eventBus and it's respective methods are deprecated and removed
from all future releases of vue, this was blocking us from migrating.
This PR replaces eventBus with
[mitt](https://github.com/developit/mitt). I have created a wrapper
mitt.js to simulate the same old event names so it's backwards
compatible, without making a lot of changes.


Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality not to work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?

1. Made sure all the places we're listening to bus events are working as
expected.
2. Respective specsf or the events from mitt.


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented on my code, particularly in hard-to-understand
areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published in downstream
modules
2024-05-31 15:50:36 +05:30
Sivin Varghese
e3eca47c31 feat: Split reconnect logic PR (store) (#9520)
# Pull Request Template

## Description

This PR includes store filter parts split from this [Reconnect
PR](https://github.com/chatwoot/chatwoot/pull/9453)
2024-05-30 12:29:55 +05:30
Shivam Mishra
6c682a6869 feat: add reauthorization banner for Facebook (#9553) 2024-05-30 09:41:04 +05:30
dependabot[bot]
b53ce3fa79 chore(deps-dev): bump rack-contrib from 2.4.0 to 2.5.0 (#9559)
Bumps rack-contrib from 2.4.0 to 2.5.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-29 13:15:05 -07:00
Sivin Varghese
41e27e95b4 fix: TypeError cannot read properties of undefined (reading 'name') (#9562) 2024-05-29 22:04:30 +05:30
Sivin Varghese
b31be37dc2 fix: TypeError undefined is not an object (evaluating 'this.features.inbound_emails') (#9563) 2024-05-29 21:31:37 +05:30
Muhsin Keloth
a55fffab3a chore: Linear integration fixes (#9538) 2024-05-29 11:28:13 +05:30
Vishnu Narayanan
59b912f22c doc: update .env.example (#9556)
- add more info on SECRET_KEY_BASE
- add a link to env variable section in selfhosted docs

Fixes https://github.com/chatwoot/chatwoot/issues/9517
2024-05-28 13:34:47 +05:30
Sivin Varghese
eb6a343810 fix: Enable edit option for custom attributes if value is present (#9543)
# Pull Request Template

## Description

This PR will enable a back edit option for custom attributes if there is
the value present, which is removed by this
[PR](https://github.com/chatwoot/chatwoot/pull/9070/files#diff-fe9b82bbef1da31faa513332ed6015c0ed23765a6368832137a5408547da8938R172)

Fixes
https://linear.app/chatwoot/issue/CW-3345/edit-attribute-does-not-work-anymore

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

**Screenrecordings**

**Before**



https://github.com/chatwoot/chatwoot/assets/64252451/ab89e087-d919-404d-90a9-17982b425dc3



**After**


https://github.com/chatwoot/chatwoot/assets/64252451/98d8b0b2-2f8f-46ec-ace5-b3e2a721623e



## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [ ] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
2024-05-28 12:05:34 +05:30
Fernando Verdugo
4a3376e912 fix(typo): Update bulkActions.json (#9540) 2024-05-24 08:51:36 -07:00
Sivin Varghese
7c5e67bf28 feat: Adds backend support for rendering tables in articles (#9526) 2024-05-24 08:44:01 +05:30
Shivam Mishra
eafd3ae44d feat: new re-authorization flow for Microsoft (#9510)
This PR adds a cleaner re-authorization flow to Microsoft. This PR has
the following changes

1. Use `reauthorization_required` value for Microsoft Channel
2. Refactor `InboxReconnectionRequired` to reuse the `banner` component
3. Refactor `microsoft/Reauthorize.vue` to reuse
`InboxReconnectionRequired` component
4. Update `reauthorizable.rb` to update cache keys if the model has an
inbox
5. Update `microsoft/callbacks_controller.rb` to handle the
reauthorization case with a redirect to the inbox settings page if the
inbox already exists at the time of authorization.

## How Has This Been Tested?

- [x] Local Instance
- [ ] Staging Instance
- [x] Unit tests

## Pending Tasks

- [ ] ~Success Toast~ will do this in a follow-up PR with the screen

## Demo

The following video shows the whole process of creation and
re-authorization of the Microsoft channel


https://www.loom.com/share/e5cd9bd4439c4741b0dcfe66d67f88b3?sid=100f3642-43e4-46b3-8123-88a5dd9d8509

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2024-05-23 16:03:40 +05:30
Shivam Mishra
616e3a8092 feat: allow setting dashboard scripts from super_admin (#9514)
This PR allows setting scripts for `vueapp.html.erb` via super admin
config. This PR has the following changes

1. Allow `DASHBOARD_SCRIPTS` in internal config
2. Remove existing scripts from `vueapp.html.erb`
3. Add scripts from `GlobalConfig` to `vueapp.html.erb`

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
2024-05-23 14:30:41 +05:30
Muhsin Keloth
f83af33b87 feat: Add title while linking the linear issue (#9529) 2024-05-23 13:32:41 +05:30
Sivin Varghese
0c4c561313 feat: Adds the ability to add line breaks in helpcenter articles (#9519) 2024-05-23 12:34:42 +05:30
Shivam Mishra
9f625715ab fix: Cannot read properties of undefined (reading 'toLowerCase') (#9511)
Tried to replicate the issue, but Sentry didn't have enough information.
`toggleMessageSignature` is a user triggered action in
`ReplyBottomPanel.vue`, the value for `channelType` is provided from
`inboxMixin`. The error will occur if either `inbox` is an empty object
`{}` or `channel_type` in `inbox` object is undefined.

I couldn't find any instance where this could be the case. The PR has a
stop gap solution that ensures that no action is triggered
2024-05-23 12:08:04 +05:30
Muhsin Keloth
35508feaae feat: Linear front end (#9491)
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
Co-authored-by: iamsivin <iamsivin@gmail.com>
2024-05-23 11:58:24 +05:30
Sivin Varghese
be97c68721 fix: TypeError cannot read properties of undefined (reading 'status') (#9505) 2024-05-23 11:22:14 +05:30
Sivin Varghese
4b93738462 fix: Space key in input closing dropdown (#9525) 2024-05-23 10:40:44 +05:30
Pranav
87d92f73d4 feat: Improve Report API performance (#9476)
- Re-write the methods for clarity
- Remove the dependency on the ReportHelper class.
- Remove n+1 queries in the average metric time series data.
2024-05-22 17:34:24 -07:00
Muhsin Keloth
023b3ad507 feat: Add APIs for linear integration (#9346) 2024-05-22 13:37:58 +05:30
Sivin Varghese
0d13c11c44 fix: Right click Snooze is not working (#9498) 2024-05-22 13:03:49 +05:30
Sojan Jose
db13049e6f fix: [Snyk] Security upgrade administrate-field-active_storage from 1.0.2 to 1.0.3 (#9496)
- Security upgrade administrate-field-active_storage from 1.0.2 to 1.0.3
2024-05-21 13:36:11 -07:00
Pranav
7a1a686133 fix: Fix typo in the font for portals (#9515)
The fonts on the portal were not loaded properly before due to a typo in
the stylesheet. The font that is shown on the public portal is ui-sans
right now. This PR fixes it.
2024-05-21 13:35:35 -07:00
Sivin Varghese
00dca9466a feat: Move the SLA filter dropdown to UI folder (#9502)
# Pull Request Template

## Description

I moved the newly created SLA filter dropdown to the UI folder to use in
adding the Linear issue modal.
2024-05-20 16:23:42 +05:30
Shivam Mishra
e9831b8855 feat: add inbox reconnection banner (#9441)
![CleanShot 2024-05-09 at 12 44
07@2x](https://github.com/chatwoot/chatwoot/assets/18097732/2b2861d4-ddcb-481a-b411-f553c19ff573)

![CleanShot 2024-05-09 at 12 44
36@2x](https://github.com/chatwoot/chatwoot/assets/18097732/9cdb8213-acce-4499-a72b-1feba2b611a6)

---------

Co-authored-by: Fayaz Ahmed <fayazara@gmail.com>
2024-05-20 11:57:03 +05:30
Shivam Mishra
f6650b5025 feat: move Azure config to installation_config (#9481)
This PR has the following changes

1. Add `AZURE_APP_ID` and `AZURE_APP_SECRET` to installation config
2. Add Microsoft config to `super_admin/features.yml`
3. Replace usage of `ENV.fetch` with `GlobalConfigService.load` for
fetch App ID and Secret
2024-05-20 11:52:42 +05:30
Shivam Mishra
00a460db43 fix: fetch FB_APP_ID from @global_config (#9483) 2024-05-17 15:44:50 +05:30
dependabot[bot]
85dcb84675 chore(deps): bump rexml from 3.2.5 to 3.2.8 (#9489)
Bumps rexml from 3.2.5 to 3.2.8.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-16 18:19:22 -07:00
Sivin Varghese
a83b609025 fix: New account button style in switch account modal (#9456) 2024-05-16 22:33:43 +05:30
Sojan
528b2dc17c Merge branch 'release/3.9.0' into develop 2024-05-15 22:32:27 -07:00
Sojan
41e373ace3 Bump version to 3.9.0 2024-05-15 22:15:52 -07:00
Chatwoot Bot
b0b4668d23 chore: Update translations (#9439)
- update translations from crowdin
2024-05-15 21:52:30 -07:00
Sojan Jose
a2d0e60a88 fix: Get online status from db when not present in cache [CW-3233] (#9477)
Previously, we returned the static value 'online' when the status was
not present in the Redis cache. This PR changes it to fall back to the
DB value and updates the cache in such cases.

fixes:
https://linear.app/chatwoot/issue/CW-3233/write-a-back-up-for-online-status-in-case-if-redis-keys-are-not
2024-05-15 21:23:19 -07:00
Sojan Jose
7b83480979 chore: Add indexes to improve reporting performance (#9478)
- Adding a new index on (account_id,created_at,message_type) based on
our performance improvement exercise. This index significantly improves
the page load speeds of messaging reports.
2024-05-15 21:21:15 -07:00
Sivin Varghese
5657473573 fix: Dashboard phone number input country undefined in onSelectCountry (#9473)
# Pull Request Template

## Description

This PR will fix this sentry
[issue](https://chatwoot-p3.sentry.io/issues/5291039795/)

**Issue**
The root cause of this issue is the usage of
`keyboardEventListenerMixins`. The key events are always active when the
edit conversation modal is active, even if the country dropdown is not
visible. So, if we press the enter key, this error will be thrown into
the console.

**Solution**
Remove the use of `keyboardEventListenerMixins` and handle it directly
in the Vue native key events. Also, always check if the dropdown is
active.

**Other changes**
1. Remove the `mouseup` event lister and use the click away directive.
2. Use inline Tailwind css


Fixes
https://linear.app/chatwoot/issue/CW-3282/phonenumberinput-country-undefined-in-onselectcountry

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

**Steps**
1. Open a conversation.
3. And click the edit contact button
4. And click the enter key
5. Now you can see the error in the console


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
2024-05-16 09:16:02 +05:30
Pranav
ae5ef73e91 fix: Update the voice note format to MP3 to fix the delivery issues (#9448)
Use MP3 as the default format to send voice notes recorded from
Chatwoot. This change was made to fix the issue of Telegram voice notes
not working with the error `WEBPAGE_CURL_FAILED` .

Telegram treats the mp3 recordings as audio attachments. Once we can
identify a fix for the original issue, we will revisit the `ogg`
implementation.

---------

Co-authored-by: Sojan Jose <sojan@pepalo.com>
2024-05-15 17:53:45 -07:00
Sojan Jose
8520846b91 chore: Improved indexes for Conversations & Contacts [CW-3300] (#9475)
Based on our recent performant optimisation exercises, We have identified a better indexing strategy for conversations and contacts. The previous index on last_activity_at for conversations significantly slowed down conversation filters. Similarly, the new index on Contacts will allow the page rendering to improve for accounts with many contacts.

fixes: https://linear.app/chatwoot/issue/CW-3300/db-improvements
2024-05-15 16:10:39 -07:00
Sojan Jose
7ed375f6f5 chore: Show valid error messages on Inbox creation (#9474)
At the moment, when creating an inbox for Whatsapp, Telegram, etc., we show a generic error message saying that inbox creation failed. This PR will show the error messages directly from the API call, which is more helpful as it says if the error is due to the provided credentials.
2024-05-15 15:53:41 -07:00
Sojan Jose
fc1c992cde fix: [Snyk] Security upgrade devise_token_auth from 1.2.1 to 1.2.3 (#9468)
fix: Gemfile & Gemfile.lock to reduce vulnerabilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-RUBY-ACTIONCABLE-20338
- https://snyk.io/vuln/SNYK-RUBY-RACK-1061917

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2024-05-15 11:52:40 -07:00
Shivam Mishra
bc8736c08e fix: widget does not load when navigating on pages with view transition [CW-3249] (#9443)
* feat: add ids to each element

* feat: restore elements for apps that use view transitions

* fix: remove generator check condition

* feat: handle turbolinks

* fix: new body handling

* chore: undo debug changes
2024-05-15 10:45:03 +05:30
Sivin Varghese
5a289776de fix: Widget phone number input country undefined in onSelectCountry (#9457)
* fix: Widget phone number input country undefined in onSelectCountry

* chore: Minor fix
2024-05-15 09:48:55 +05:30
Sojan Jose
e98e27dc1f chore: Make IP_LOOKUP_BASE_URL configurable (#9467)
Since we download the GeoIP database during worker/server initialization, there is a high chance of spamming the server with too many requests for downloads, especially if the number of web and worker nodes is high. This PR provides the ability to specify a custom URL for the GeoLite database download, configurable via an environment variable. This helps in distributing the load and avoiding server overload during the initialization process
2024-05-14 14:32:17 -07:00
Sojan Jose
d54492f7b5 chore: Add debug statement in spec (#9466)
- Add a debug statement to check the failed specs
2024-05-14 14:19:02 -07:00
dependabot[bot]
1d4798a3bf chore(deps): bump nokogiri from 1.16.4 to 1.16.5 (#9459)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.16.4...v1.16.5)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-13 18:12:02 -07:00
Sojan Jose
e992283993 fix: [Snyk] Security upgrade omniauth-rails_csrf_protection from 1.0.1 to 1.0.2 (#9454)
fix: Gemfile & Gemfile.lock to reduce vulnerabilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-RUBY-RACK-1061917

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2024-05-13 16:07:56 -07:00
Sojan Jose
07e33fd98a chore: Switch models to gpt-4o (#9458)
- Switch model to gpt-4o from gpt-4-turbo
2024-05-13 13:32:11 -07:00
Sojan Jose
9a8442fe0e chore: Handle conversation participation creation race condition error (#9449)
We observed some race condition errors in the conversation participation listener while trying to create a conversation participation assignment. This PR handles this error and also adds additional debug information for future.

fixes: https://linear.app/chatwoot/issue/CW-3296/activerecordrecordnotunique-pguniqueviolation-error-duplicate-key

## Changelog

- handles `ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvald` errors so that they won't pollute sentry
- Adds a debug statement to log the cases
- Add previous_changes into the dispatcher so that we know the exact attribute changes which trigger `assignee_changed, team_changed` events ( would be handy in future )
2024-05-10 12:21:23 -07:00
Vishnu Narayanan
dd1f93d425 feat: Switch Heroku Postgres basic to essential-0 (#9452) 2024-05-10 09:52:04 -07:00
Shivam Mishra
a4001374a5 feat: add missing clickaway directives (#9451)
* feat: add onClickaway to widget

* feat: add clickaway to portal

* feat: add directive to PublicArticleSearch
2024-05-10 11:15:36 +05:30