Split ticket and group name fixes
This commit is contained in:
parent
69394c813d
commit
a882c9ecff
5 changed files with 37 additions and 7 deletions
|
|
@ -282,6 +282,35 @@ const sendSignalMessageTask = async ({
|
||||||
},
|
},
|
||||||
"Message sent successfully",
|
"Message sent successfully",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Update group name to use consistent template with ticket number
|
||||||
|
// This ensures groups created by receive-signal-message get renamed
|
||||||
|
// to match the template (e.g., "Support Request: 94085")
|
||||||
|
if (finalTo.startsWith("group.") && conversationId) {
|
||||||
|
try {
|
||||||
|
const expectedGroupName = buildSignalGroupName(conversationId);
|
||||||
|
await groupsClient.v1GroupsNumberGroupidPut({
|
||||||
|
number: bot.phoneNumber,
|
||||||
|
groupid: finalTo,
|
||||||
|
data: {
|
||||||
|
name: expectedGroupName,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
logger.debug(
|
||||||
|
{ groupId: finalTo, newName: expectedGroupName },
|
||||||
|
"Updated group name",
|
||||||
|
);
|
||||||
|
} catch (renameError) {
|
||||||
|
// Non-fatal - group name update is best-effort
|
||||||
|
logger.warn(
|
||||||
|
{
|
||||||
|
error: renameError instanceof Error ? renameError.message : renameError,
|
||||||
|
groupId: finalTo,
|
||||||
|
},
|
||||||
|
"Could not update group name",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
// Try to get the actual error message from the response
|
// Try to get the actual error message from the response
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,6 @@ const envFile = path.resolve(process.cwd(), '.env');
|
||||||
const finalFiles = files[app]
|
const finalFiles = files[app]
|
||||||
.map((file) => ['-f', `docker/compose/${file}.yml`]).flat();
|
.map((file) => ['-f', `docker/compose/${file}.yml`]).flat();
|
||||||
|
|
||||||
// Add bridge-dev.yml for dev commands that include zammad
|
|
||||||
const devAppsWithZammad = ['linkDev', 'bridgeDev', 'all'];
|
|
||||||
if (devAppsWithZammad.includes(app) && files[app].includes('zammad')) {
|
|
||||||
finalFiles.push('-f', 'docker-compose.bridge-dev.yml');
|
|
||||||
}
|
|
||||||
|
|
||||||
const finalCommand = command === "up" ? ["up", "-d", "--remove-orphans"] : [command];
|
const finalCommand = command === "up" ? ["up", "-d", "--remove-orphans"] : [command];
|
||||||
const dockerCompose = spawn('docker', ['compose', '--env-file', envFile, ...finalFiles, ...finalCommand]);
|
const dockerCompose = spawn('docker', ['compose', '--env-file', envFile, ...finalFiles, ...finalCommand]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ RUN if [ "$EMBEDDED" = "true" ] ; then \
|
||||||
sed -i '$ d' /opt/zammad/contrib/nginx/zammad.conf && \
|
sed -i '$ d' /opt/zammad/contrib/nginx/zammad.conf && \
|
||||||
echo "" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
echo "" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
||||||
echo " location /link {" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
echo " location /link {" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
||||||
echo " proxy_pass ${LINK_HOST};" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
echo " set \$link_url ${LINK_HOST}; proxy_pass \$link_url;" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
||||||
echo " proxy_set_header Host \$host;" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
echo " proxy_set_header Host \$host;" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
||||||
echo " proxy_set_header X-Real-IP \$remote_addr;" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
echo " proxy_set_header X-Real-IP \$remote_addr;" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
||||||
echo " proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
echo " proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;" >> /opt/zammad/contrib/nginx/zammad.conf && \
|
||||||
|
|
|
||||||
|
|
@ -264,6 +264,11 @@ class ChannelsCdrSignalController < ApplicationController
|
||||||
chat_id: chat_id
|
chat_id: chat_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Store original recipient phone for group tickets to enable ticket splitting
|
||||||
|
if is_group_message
|
||||||
|
cdr_signal_prefs[:original_recipient] = sender_phone_number
|
||||||
|
end
|
||||||
|
|
||||||
Rails.logger.info "=== CREATING NEW TICKET ==="
|
Rails.logger.info "=== CREATING NEW TICKET ==="
|
||||||
Rails.logger.info "Preferences to be stored:"
|
Rails.logger.info "Preferences to be stored:"
|
||||||
Rails.logger.info " - channel_id: #{channel.id}"
|
Rails.logger.info " - channel_id: #{channel.id}"
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ module Link::SetupSplitSignalGroup
|
||||||
'chat_id' => original_recipient, # Phone number, NOT group ID
|
'chat_id' => original_recipient, # Phone number, NOT group ID
|
||||||
'original_recipient' => original_recipient
|
'original_recipient' => original_recipient
|
||||||
}
|
}
|
||||||
|
# Set article type so Zammad shows Signal reply option
|
||||||
|
child_ticket.create_article_type_id = Ticket::Article::Type.find_by(name: 'cdr_signal')&.id
|
||||||
child_ticket.save!
|
child_ticket.save!
|
||||||
|
|
||||||
Rails.logger.info "Signal split: Ticket ##{child_ticket.number} set up for new group (recipient: #{original_recipient})"
|
Rails.logger.info "Signal split: Ticket ##{child_ticket.number} set up for new group (recipient: #{original_recipient})"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue