Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 543 error displaying username with underscore #586

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions bot/modules/dispute/messages.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { getDisputeChannel, getDetailedOrder } = require('../../../util');
const { getDisputeChannel, getDetailedOrder, sanitizeMD } = require('../../../util');
const { logger } = require('../../../logger');

exports.beginDispute = async (ctx, initiator, order, buyer, seller) => {
Expand Down Expand Up @@ -87,11 +87,18 @@ exports.disputeData = async (
}

const detailedOrder = getDetailedOrder(ctx.i18n, order, buyer, seller);

// Fix Issue 543: Escape underscores in usernames
const escapedInitiatorUsername = sanitizeMD(initiatorUser.username);
const escapedCounterPartyUsername = sanitizeMD(counterPartyUser.username);

await ctx.telegram.sendMessage(
solver.tg_id,
ctx.i18n.t('dispute_started_channel', {
initiatorUser,
counterPartyUser,
initiatorUser: { ...initiatorUser, username: escapedInitiatorUsername },
initiatorTgId: initiatorUser.tg_id,
counterPartyUser: { ...counterPartyUser, username: escapedCounterPartyUsername },
counterPartyUserTgId: counterPartyUser.tg_id,
buyer,
seller,
buyerDisputes,
Expand All @@ -108,14 +115,14 @@ exports.disputeData = async (
await ctx.telegram.sendMessage(
buyer.tg_id,
ctx.i18n.t('dispute_solver', {
solver: solver.username,
solver: sanitizeMD(solver.username),
token: order.buyer_dispute_token,
})
);
await ctx.telegram.sendMessage(
seller.tg_id,
ctx.i18n.t('dispute_solver', {
solver: solver.username,
solver: sanitizeMD(solver.username),
token: order.seller_dispute_token,
})
);
Expand Down
4 changes: 2 additions & 2 deletions locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ order_detail: |
seller: Käufer
buyer: Verkäufer
dispute_started_channel: |
Benutzer ${type} @${initiatorUser.username}
hat einen Streitfall mit @${counterPartyUser.username} für den folgenden Auftrag eröffnet
Benutzer ${type} @${initiatorUser.username} TG ID: ${initiatorTgId}
hat einen Streitfall mit @${counterPartyUser.username} TG ID: ${counterPartyUserTgId} für den folgenden Auftrag eröffnet

${detailedOrder}

Expand Down
4 changes: 2 additions & 2 deletions locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ order_detail: |
seller: seller
buyer: buyer
dispute_started_channel: |
User ${type} @${initiatorUser.username}
has started a dispute with @${counterPartyUser.username} for the order
User ${type} @${initiatorUser.username} TG ID: ${initiatorTgId}
has started a dispute with @${counterPartyUser.username} TG ID: ${counterPartyUserTgId} for the order

${detailedOrder}

Expand Down
8 changes: 4 additions & 4 deletions locales/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,16 @@ order_detail: |
seller: vendedor
buyer: comprador
dispute_started_channel: |
El ${type} @${initiatorUser.username}
ha iniciado una disputa con @${counterPartyUser.username} en la orden:
El ${type} @${initiatorUser.username} TG ID: ${initiatorTgId}
ha iniciado una disputa con @${counterPartyUser.username} TG ID: ${counterPartyUserTgId} en la orden:

${detailedOrder}

Seller Token: ${sellerToken}
Buyer Token: ${buyerToken}

@${buyer.username} ya tiene ${buyerDisputes} disputas
@${seller.username} ya tiene ${sellerDisputes} disputas
@${initiatorUser.username} ya tiene ${buyerDisputes} disputas
@${counterPartyUser.username} ya tiene ${sellerDisputes} disputas
you_started: '🥴 Has iniciado una disputa en tu orden con Id: ${orderId}.'
counterpart_started: '🥴 Tu contraparte ha iniciado una disputa en tu orden con Id: ${orderId}.'
dispute_started: '${who} Un solver te atenderá pronto, cuando él/la solver sea asignado a tu disputa el bot te dirá su username, solo él/ella podrá atenderte. Puedes escribirle directamente, pero si él/ella te contacta primero, debes pedirle que te diga cuál es el token de tu disputa, tu token es: ${token}.'
Expand Down
4 changes: 2 additions & 2 deletions locales/fa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ order_detail: |
seller: seller
buyer: buyer
dispute_started_channel: |
کاربر ${type} @${initiatorUser.username}
بابت سفارش زیر یک مشاجره را با کاربر @${counterPartyUser.username}آغاز کرده
کاربر ${type} @${initiatorUser.username} TG ID: ${initiatorTgId}
بابت سفارش زیر یک مشاجره را با کاربر @${counterPartyUser.username} TG ID: ${counterPartyUserTgId} آغاز کرده

${detailedOrder}

Expand Down
4 changes: 2 additions & 2 deletions locales/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ order_detail: |
seller: vendeur
buyer: acheteur
dispute_started_channel: |
L'utilisateur ${type} @${initiatorUser.username}
à déclenché un litige avec @${counterPartyUser.username} concernant l'offre
L'utilisateur ${type} @${initiatorUser.username} TG ID: ${initiatorTgId}
à déclenché un litige avec @${counterPartyUser.username} TG ID: ${counterPartyUserTgId} concernant l'offre

${detailedOrder}

Expand Down
4 changes: 2 additions & 2 deletions locales/it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ order_detail: |
seller: venditore
buyer: acquirente
dispute_started_channel: |
User ${type} @${initiatorUser.username}
ha iniziato una disputa con @${counterPartyUser.username} per l'ordine
User ${type} @${initiatorUser.username} TG ID: ${initiatorTgId}
ha iniziato una disputa con @${counterPartyUser.username} TG ID: ${counterPartyUserTgId} per l'ordine

${detailedOrder}

Expand Down
4 changes: 2 additions & 2 deletions locales/ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ order_detail: |
seller: 판매자
buyer: 구매자
dispute_started_channel: |
사용자 ${type} @${initiatorUser.username}
님께서 @${counterPartyUser.username}와의 분쟁 조정을 시작하였습니다. 주문 상세 내역은 다음과 같습니다.
사용자 ${type} @${initiatorUser.username} TG ID: ${initiatorTgId}
님께서 @${counterPartyUser.username} TG ID: ${counterPartyUserTgId} 와의 분쟁 조정을 시작하였습니다. 주문 상세 내역은 다음과 같습니다.

${detailedOrder}

Expand Down
4 changes: 2 additions & 2 deletions locales/pt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ order_detail: |
seller: vendedora
buyer: compradora
dispute_started_channel: |
Usuário ${type} @${initiatorUser.username}
iniciou uma disputa com @${counterPartyUser.username} para o pedido
Usuário ${type} @${initiatorUser.username} TG ID: ${initiatorTgId}
iniciou uma disputa com @${counterPartyUser.username} TG ID: ${counterPartyUserTgId} para o pedido

${detailedOrder}

Expand Down
4 changes: 2 additions & 2 deletions locales/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ order_detail: |
seller: продавец
buyer: покупатель
dispute_started_channel: |
${type} @${initiatorUser.username}
инициировал разбирательство с @${counterPartyUser.username} относительно заявки:
${type} @${initiatorUser.username} TG ID: ${initiatorTgId}
инициировал разбирательство с @${counterPartyUser.username} TG ID: ${counterPartyUserTgId} относительно заявки:

${detailedOrder}

Expand Down
4 changes: 2 additions & 2 deletions locales/uk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ order_detail: |
seller: продавець
buyer: покупець
dispute_started_channel: |
${type} @${initiatorUser.username}
ініціював диспут з @${counterPartyUser.username} щодо заявки:
${type} @${initiatorUser.username} TG ID: ${initiatorTgId}
ініціював диспут з @${counterPartyUser.username} TG ID: ${counterPartyUserTgId} щодо заявки:

${detailedOrder}

Expand Down
Loading
Loading