Compare commits

...
Author SHA1 Message Date
Shivam MishraandGitHub 5f998d6123 Merge branch 'develop' into feature/cw-1605 2023-05-18 17:51:31 +05:30
Shivam Mishra 80a66174a7 feat: include messages 2023-05-18 17:40:28 +05:30
Shivam Mishra 1b55172eb7 refactor: use first instead of count 2023-05-18 17:40:11 +05:30
Vishnu NarayananandGitHub 590ce788b9 fix: update linux script(cwctl) to account for rails7 upgrade (#7106)
* chore: modify cwctl to fetch latest redis version on new installations

* fix: add libvips for activestorage imageprocessing support

* chore: update cwctl version

* feat: upgrade redis and install libvps for existing installations
2023-05-18 16:53:47 +05:30
Clairton Rodrigo HeinzenandGitHub a25179c342 fix: Instagram events job NoMethodError: undefined method for nil:NilClass (#7105)
- Sometimes tag entry does not have messaging or standby and cause a error
2023-05-18 15:22:01 +05:30
Sivin VargheseandGitHub aea9470b6a fix: RTL issue for basic filter dropdown (#7118) 2023-05-18 15:06:18 +05:30
Muhsin KelothandGitHub 6382707146 chore: Check assignee exists or not before rendering the assignee avatar (#7104) 2023-05-17 15:41:23 +05:30
Shivam Mishra 318e0b10e4 Merge branch 'develop' of github.com:chatwoot/chatwoot into feature/cw-1605 2023-05-10 23:23:40 +05:30
Shivam Mishra db9daa5fb6 Merge branch 'develop' of github.com:chatwoot/chatwoot into feature/cw-1605 2023-05-10 17:50:37 +05:30
Shivam Mishra d68345672c fix: typo 2023-05-09 15:10:47 +05:30
Shivam Mishra 1a74e52445 feat: ensure the clean-up logic works 2023-05-09 14:24:35 +05:30
Shivam Mishra ae5deca24b test: update to check for preloaded_label_list 2023-05-09 14:05:28 +05:30
Shivam Mishra 7c174cacc8 Merge branch 'develop' of github.com:chatwoot/chatwoot into feature/cw-1605 2023-05-09 13:30:38 +05:30
Shivam MishraandGitHub 43b5750314 Merge branch 'develop' into feature/cw-1605 2023-05-05 17:00:17 +05:30
Shivam Mishra 1a19c864d3 fix: use message_count only if it is available 2023-05-05 16:57:22 +05:30
Shivam Mishra 9614e19d82 fix: remove byebug in comments 2023-05-05 16:29:23 +05:30
Shivam Mishra 1a812692c9 refactor: better naming 2023-05-04 13:49:14 +05:30
Shivam Mishra ce394e7f08 fix: new line 2023-05-04 13:46:39 +05:30
Shivam Mishra d3afe64bb1 feat: preload messages_count 2023-05-04 13:17:55 +05:30
Shivam Mishra 9cff6c04ee feat: preload label list 2023-05-04 12:56:06 +05:30
11 changed files with 77 additions and 12 deletions
+1 -1
View File
@@ -1 +1 @@
2.2.0
2.17.0
+1 -1
View File
@@ -1 +1 @@
2.1.0
2.3.0
@@ -261,6 +261,12 @@
}
}
// Basic filter dropdown
.basic-filter {
left: 0;
right: unset;
}
// Card label
.label-container {
.label {
@@ -37,7 +37,7 @@
</div>
<div>
<thumbnail
v-if="notificationItem.primary_actor.meta.assignee"
v-if="hasAssignee(notificationItem)"
:src="notificationItem.primary_actor.meta.assignee.thumbnail"
size="16px"
:username="notificationItem.primary_actor.meta.assignee.name"
@@ -127,6 +127,9 @@ export default {
});
}
},
hasAssignee(notification) {
return notification.primary_actor.meta?.assignee;
},
},
};
</script>
+1 -1
View File
@@ -31,6 +31,6 @@ class Webhooks::InstagramEventsJob < ApplicationJob
end
def messages(entry)
(entry[:messaging].presence || entry[:standby])
(entry[:messaging].presence || entry[:standby] || [])
end
end
@@ -48,7 +48,6 @@ class JsonSchemaValidator < ActiveModel::Validator
# Add validation errors to the record with a formatted statement
validation_errors.each do |error|
# byebug
format_and_append_error(error, record)
end
end
+18
View File
@@ -3,6 +3,7 @@ module Labelable
included do
acts_as_taggable_on :labels
before_save :clear_labels_cache
end
def update_labels(labels = nil)
@@ -13,4 +14,21 @@ module Labelable
new_labels << labels
update!(label_list: new_labels)
end
def preloaded_label_list
unless @labels_cache
@labels_cache = []
taggings.each do |tagging|
@labels_cache << tagging.tag.name
end
end
@labels_cache || []
end
private
def clear_labels_cache
@labels_cache = nil
end
end
+2 -1
View File
@@ -58,8 +58,9 @@ class Conversations::FilterService < FilterService
def conversations
@conversations = @conversations.includes(
:taggings, :inbox, { assignee: { avatar_attachment: [:blob] } }, { contact: { avatar_attachment: [:blob] } }, :team
:taggings, :inbox, { assignee: { avatar_attachment: [:blob] } }, { contact: { avatar_attachment: [:blob] } }, :team, :messages
)
@conversations.latest.page(current_page)
end
end
@@ -17,8 +17,8 @@ json.meta do
end
json.id conversation.display_id
if conversation.messages.count.zero?
json.messages []
if !conversation.messages.first.present?
json.messages []
elsif conversation.unread_incoming_messages.count.zero?
json.messages [conversation.messages.includes([{ attachments: [{ file_attachment: [:blob] }] }]).last.try(:push_event_data)]
else
@@ -33,7 +33,7 @@ json.can_reply conversation.can_reply?
json.contact_last_seen_at conversation.contact_last_seen_at.to_i
json.custom_attributes conversation.custom_attributes
json.inbox_id conversation.inbox_id
json.labels conversation.label_list
json.labels conversation.preloaded_label_list
json.muted conversation.muted?
json.snoozed_until conversation.snoozed_until
json.status conversation.status
+27 -3
View File
@@ -2,7 +2,7 @@
# Description: Install and manage a Chatwoot installation.
# OS: Ubuntu 20.04 LTS
# Script Version: 2.2.0
# Script Version: 2.3.0
# Run this script as root
set -eu -o errexit -o pipefail -o noclobber -o nounset
@@ -19,7 +19,7 @@ fi
# option --output/-o requires 1 argument
LONGOPTS=console,debug,help,install,Install:,logs:,restart,ssl,upgrade,webserver,version
OPTIONS=cdhiI:l:rsuwv
CWCTL_VERSION="2.2.0"
CWCTL_VERSION="2.3.0"
pg_pass=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 15 ; echo '')
# if user does not specify an option
@@ -175,6 +175,8 @@ function install_dependencies() {
curl -sL https://deb.nodesource.com/setup_16.x | bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
apt update
apt install -y \
@@ -183,7 +185,8 @@ function install_dependencies() {
libssl-dev libyaml-dev libreadline-dev gnupg2 \
postgresql-client redis-tools \
nodejs yarn patch ruby-dev zlib1g-dev liblzma-dev \
libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev sudo
libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev sudo \
libvips
}
##############################################################################
@@ -708,6 +711,26 @@ function upgrade_prereq() {
EOF
}
##############################################################################
# Update redis to v7+ for Rails 7 support(-u/--upgrade)
# and install libvips for image processing support in Rails 7
# Globals:
# None
# Arguments:
# None
# Outputs:
# None
##############################################################################
function upgrade_redis() {
echo "Upgrading Redis to v7+ for Rails 7 support(Chatwoot v2.17+)"
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
apt update -y
apt upgrade redis-server -y
apt install libvips -y
}
##############################################################################
# Upgrade an existing installation to latest stable version(-u/--upgrade)
# Globals:
@@ -722,6 +745,7 @@ function upgrade() {
echo "Upgrading Chatwoot to v$CW_VERSION"
sleep 3
upgrade_prereq
upgrade_redis
sudo -i -u chatwoot << "EOF"
# Navigate to the Chatwoot directory
+14
View File
@@ -243,6 +243,20 @@ RSpec.describe Conversation, type: :model do
expect(conversation.label_list).to match_array(labels)
end
it 'ensures preloaded labels are always in sync with the database' do
labels = [first_label].map(&:title)
expect(conversation.update_labels(labels)).to be(true)
expect(conversation.label_list).to match_array(labels)
expect(conversation.preloaded_label_list).to match_array(labels)
updated_labels = [second_label].map(&:title)
# reload this so that the taggins collection is updated
conversation.reload
expect(conversation.update_labels(updated_labels)).to be(true)
expect(conversation.label_list).to match_array(updated_labels)
expect(conversation.preloaded_label_list).to match_array(updated_labels)
end
it 'adds and removes previously added labels' do
labels = [first_label, fourth_label].map(&:title)
expect { conversation.update_labels(labels) }