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

[IMPROVE] Support for tag request close when is obligatory to close Omnichannel's Channel #4353

Merged
merged 18 commits into from
Jul 15, 2022

Conversation

reinaldonetof
Copy link
Contributor

@reinaldonetof reinaldonetof commented Jul 11, 2022

Proposed changes

Currently, mobile does not give support for the Request tag(s) before closing conversation option for Omnichannel Departments. Because of that, when an agent tries to close a chat and their department has that option active, the agent does not receive the request for a tag.
The chat ends up not being closed, and they receive no feedback on what's happening.

Issue(s)

How to test or reproduce

  • As an agent, your department must enable Request tag(s) before closing conversation

  • Take a new Omnichannel Chat

  • Try closing it

  • Trying to close an old chat without tags.

Screenshots

Screen.Recording.2022-07-14.at.21.59.32.mov

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

@reinaldonetof reinaldonetof changed the title [IMPROVE] Support for tag request close [IMPROVE] Support for tag request close when is obligatory to close Omnichannel's Channel Jul 12, 2022
Comment on lines +269 to +278
onPress: () => {
if (isMasterDetail) {
navigation.navigate('ModalStackNavigator', {
screen: 'ForwardLivechatView',
params: { rid }
});
} else {
navigation.navigate('ForwardLivechatView', { rid });
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the navigation to ForwardLivechatView using the tablets. That was missing.

app/i18n/locales/en.json Show resolved Hide resolved
// RC 0.29.0
sdk.methodCallWrapper('livechat:closeRoom', rid, comment, { clientAction: true });
sdk.methodCallWrapper('livechat:closeRoom', rid, comment, { clientAction: true, tags });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure old versions of the server are accepting this extra argument?
I'm not talking about disabling the feature, but backwards compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have this answer right now, but I will search for it. At least, in which version of the server the tags were introduced

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tags were introduced here: RocketChat/Rocket.Chat#17254

2 years ago!

Instead of creating a condition for which version of the server, I decided to send the extra argument only when there are tags selected.

} else {
setCanSubmit(false);
}
}, [inputValue, livechatRequestComment, requestTags, tagParamSelected]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything on this dependency array is a state.
Every time they update, a re-render is triggered.
What you're doing is triggering a new re-render whenever they update to update canSubmit and then update the button.

That's unnecessary.
Since you already know the render is going to get triggered, you can use a normal constant instead of a state.

This is much better.

let canSubmit = false;

if (!requestTags && !livechatRequestComment) {
  canSubmit = true;
}
// ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice point!

app/lib/services/restApi.ts Outdated Show resolved Hide resolved
app/views/CloseLivechatView.tsx Outdated Show resolved Hide resolved
app/lib/services/restApi.ts Outdated Show resolved Hide resolved
@reinaldonetof reinaldonetof dismissed diegolmello’s stale review July 15, 2022 20:04

Daniel approved :)

@reinaldonetof reinaldonetof merged commit fe7722c into develop Jul 15, 2022
@reinaldonetof reinaldonetof deleted the new.request-tag branch July 15, 2022 20:06
ivnxyz pushed a commit to NextiaDev/Rocket.Chat.ReactNative that referenced this pull request May 26, 2023
…mnichannel's Channel (RocketChat#4353)

* [IMPROVE] Support for tag request close

* clean up

* refactor isObrigatory and value

* fix obligatory

* removed onSubmitEditing

* create closelivechatview

* Refactor Close Omnichannel from ActionSheet to a new Screen

* Fix navigation

* fix screen title

* back to before actionsheetwithinput

* added string in pt-br

* refactor canSubmit

* fix the method closeRoom

* comment of server's version

* some tweaks

* Update app/lib/services/restApi.ts

Co-authored-by: Gleidson Daniel Silva <gleidson10daniel@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants