From f3154e770e6bd2286dca113d8b91275a4eca156d Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Tue, 28 Jan 2020 18:36:23 +0100 Subject: [PATCH] Fixed maxVisits being set to 0 when trying to reset it --- CHANGELOG.md | 23 +++++++++++++++++++++++ src/short-urls/helpers/EditMetaModal.js | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 543aee7a..3d467d72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org). +## [Unreleased] + +#### Added + +* *Nothing* + +#### Changed + +* *Nothing* + +#### Deprecated + +* *Nothing* + +#### Removed + +* *Nothing* + +#### Fixed + +* [#193](https://github.com/shlinkio/shlink-web-client/issues/193) Fixed `maxVisits` being set to 0 when trying to reset it from having a value to `null`. + + ## 2.3.0 - 2020-01-19 #### Added diff --git a/src/short-urls/helpers/EditMetaModal.js b/src/short-urls/helpers/EditMetaModal.js index f4cec441..3d403be8 100644 --- a/src/short-urls/helpers/EditMetaModal.js +++ b/src/short-urls/helpers/EditMetaModal.js @@ -5,7 +5,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faInfoCircle as infoIcon } from '@fortawesome/free-solid-svg-icons'; import { ExternalLink } from 'react-external-link'; import moment from 'moment'; -import { pipe } from 'ramda'; +import { isEmpty, pipe } from 'ramda'; import { shortUrlType } from '../reducers/shortUrlsList'; import { shortUrlEditMetaType } from '../reducers/shortUrlMeta'; import DateInput from '../../utils/DateInput'; @@ -37,7 +37,7 @@ const EditMetaModal = ( const close = pipe(resetShortUrlMeta, toggle); const doEdit = () => editShortUrlMeta(shortUrl.shortCode, { - maxVisits: maxVisits && parseInt(maxVisits), + maxVisits: maxVisits && !isEmpty(maxVisits) ? parseInt(maxVisits) : null, validSince: validSince && formatIsoDate(validSince), validUntil: validUntil && formatIsoDate(validUntil), }).then(close);