Dont encode '+' symbols and add share menu item back

This commit is contained in:
Gregory Schier 2017-01-12 16:45:15 -08:00
parent 0ff8f977fa
commit 0c66afbf4b
5 changed files with 23 additions and 13 deletions

View File

@ -131,8 +131,8 @@ describe('prepareUrlForSending()', () => {
it('doesn\'t decode ignored characters', () => {
// Encoded should skip raw versions of @ ; ,
const url = misc.prepareUrlForSending('https://google.com/@;,&^');
expect(url).toBe('https://google.com/@;,%26%5E');
const url = misc.prepareUrlForSending('https://google.com/@;,&^+');
expect(url).toBe('https://google.com/@;,%26%5E+');
// Encoded should skip encoded versions of @ ; ,
const url2 = misc.prepareUrlForSending('https://google.com/%40%3B%2C%26%5E');

View File

@ -94,7 +94,7 @@ export function flexibleEncodeComponent (str, ignore = '') {
str = str.replace(re, `__ENCODED_${code}_ENCODED__`);
// Replace raw versions
const re2 = new RegExp(c, 'g');
const re2 = new RegExp(`[${c}]`, 'g');
str = str.replace(re2, `__RAW_${code}_RAW__`);
}
@ -136,7 +136,7 @@ export function prepareUrlForSending (url) {
if (parsedUrl.pathname) {
const segments = parsedUrl.pathname.split('/');
parsedUrl.pathname = segments.map(
s => flexibleEncodeComponent(s, ',;@')
s => flexibleEncodeComponent(s, '+,;@')
).join('/')
}

View File

@ -95,9 +95,9 @@ class WorkspaceDropdown extends Component {
<DropdownHint char="&#8679;,"/>
</DropdownItem>
{/*<DropdownItem onClick={this._handleShowShareSettings}>*/}
{/*<i className="fa fa-user"/> Share <strong>{activeWorkspace.name}</strong>*/}
{/*</DropdownItem>*/}
<DropdownItem onClick={this._handleShowShareSettings}>
<i className="fa fa-user"/> Share <strong>{activeWorkspace.name}</strong>
</DropdownItem>
<DropdownDivider>Switch Workspace</DropdownDivider>

View File

@ -76,7 +76,7 @@ class ChangelogModal extends Component {
if (change.link) {
html = [
...html,
<Link href={change.link} className="btn btn--clicky" button={true} key="link">
<Link href={change.link} className="btn btn--clicky" button={true} key={`link.${i}`}>
Read More
</Link>
]

View File

@ -21,6 +21,10 @@ class WorkspaceShareSettingsModal extends Component {
_setModalRef = m => this.modal = m;
_handleUnshare = async () => {
if (!session.isLoggedIn()) {
return;
}
const {resourceGroup} = this.state;
this._resetState({loading: true});
@ -56,7 +60,8 @@ class WorkspaceShareSettingsModal extends Component {
async _load () {
if (!session.isLoggedIn()) {
showModal(LoginModal);
this._resetState({});
return;
}
const {workspace} = this.props;
@ -107,14 +112,14 @@ class WorkspaceShareSettingsModal extends Component {
<ModalBody key="body" className="pad text-center" noScroll={true}>
<p>
Share <strong>{workspace.name}</strong> to automatically sync
all data with your team members.
your API workspace with your team members.
</p>
<div className="form-control pad">
{error ? <div className="danger">Oops: {error}</div> : null}
<Dropdown outline={true}>
<DropdownDivider>Teams</DropdownDivider>
{!loading && resourceGroup ? (
resourceGroup.teamId ? (
{!loading ? (
resourceGroup && resourceGroup.teamId ? (
<DropdownButton className="btn btn--clicky">
<i className="fa fa-users"/> Shared with
{" "}
@ -139,6 +144,11 @@ class WorkspaceShareSettingsModal extends Component {
<i className="fa fa-users"/> Share with <strong>{team.name}</strong>
</DropdownItem>
))}
{teams.length === 0 ? (
<DropdownItem disabled={true} onClick={this._handleShareWithTeam}>
<i className="fa fa-warning"/> You have no teams
</DropdownItem>
) : null}
<DropdownDivider>Other</DropdownDivider>
<DropdownItem buttonClass={PromptButton}
addIcon={true}
@ -151,7 +161,7 @@ class WorkspaceShareSettingsModal extends Component {
<Link button={true}
className="btn btn--super-compact inline-block"
href="https://insomnia.rest/app/teams/">
Manage Team
Manage Teams
</Link>
</div>
</ModalBody>