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

Nada/88951/change chat url #7798

Merged
merged 14 commits into from
Mar 21, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const OrderDetails = observer(() => {
order_store.setIsRecommended(undefined);
my_profile_store.getPaymentMethodsList();

// TODO: remove condition check once access chat_channel_url from p2p_order_create is activated in BO
if (order_channel_url) {
sendbird_store.setChatChannelUrl(order_channel_url);
} else {
Expand Down
3 changes: 3 additions & 0 deletions packages/p2p/src/stores/buy-sell-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ export default class BuySellStore extends BaseStore {
}

handleSubmit = async (isMountedFn, values, { setSubmitting }) => {
const { sendbird_store } = this.root_store;
if (isMountedFn()) {
setSubmitting(true);
}
Expand All @@ -272,6 +273,7 @@ export default class BuySellStore extends BaseStore {
advert_id: this.advert.id,
amount: values.amount,
payment_method_ids: this.payment_method_ids,
subscribe: 1,
...(values.payment_info && this.is_sell_advert ? { payment_info: values.payment_info } : {}),
// Validate extra information for sell adverts.
...(this.is_sell_advert
Expand All @@ -293,6 +295,7 @@ export default class BuySellStore extends BaseStore {
this.form_props.setErrorMessage(null);
this.root_store.general_store.hideModal();
this.root_store.floating_rate_store.setIsMarketRateChanged(false);
sendbird_store.setChatChannelUrl(order?.p2p_order_create?.chat_channel_url ?? '');
const response = await requestWS({ p2p_order_info: 1, id: order.p2p_order_create.id });
this.form_props.handleConfirm(response.p2p_order_info);
this.form_props.handleClose();
Expand Down
1 change: 1 addition & 0 deletions packages/p2p/src/stores/sendbird-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default class SendbirdStore extends BaseStore {
this.chat_messages.push(chat_message);
}

// TODO: remove when access chat_channel_url from p2p_order_create is activated in BO
createChatForNewOrder(id) {
if (!this.chat_channel_url) {
// If order_information doesn't have chat_channel_url this is a new order
Expand Down