Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
edmoss345 committed Nov 21, 2023
1 parent 69855be commit b5049c5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions chatbot/insert/modify_quick_replies.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ function reformat_quick_replies(flows, select_phrases, count_threshold, length_t
}

function convert_qr_to_html(flows) {


const exceptions = []
let debug = '';
let debug_lang = {};

for (const flow of flows.flows) {

Expand All @@ -167,7 +170,7 @@ function convert_qr_to_html(flows) {
if (qr_count > 0) {
let quick_replies = augment_quick_replies(action, exceptions, curr_loc);

add_quick_replies_to_msg_text_html(action, quick_replies, curr_loc, select_phrases);
add_quick_replies_to_msg_text_html(action, quick_replies, curr_loc);

clear_quick_replies(node, routers, action, curr_loc, quick_replies, "no");
}
Expand Down Expand Up @@ -235,18 +238,16 @@ function add_quick_replies_to_msg_text(action, quick_replies, curr_loc, select_p
}
}

function add_quick_replies_to_msg_text_html(action, quick_replies, curr_loc, select_phrases) {
function add_quick_replies_to_msg_text_html(action, quick_replies, curr_loc) {
const formatQuickReplyLink = (text) => `<a href=""weixin://bizmsgmenu?msgmenucontent=${text}&msgmenuid=projectid"">${text}</a>`;
action.text = [
action.text,
'\n' + select_phrases["eng"],
...quick_replies.map((qr) => formatQuickReplyLink(qr.text))
].join('\n');

for (const [lang, translations] of Object.entries(curr_loc)) {
translations[action.uuid].text[0] = [
translations[action.uuid].text[0],
'\n' + select_phrases[lang],
...quick_replies.map((qr) => formatQuickReplyLink(qr.translations[lang]))
].join('\n');
}
Expand Down

0 comments on commit b5049c5

Please sign in to comment.