diff options
-rw-r--r-- | model/search_params.go | 4 | ||||
-rw-r--r-- | model/search_params_test.go | 4 | ||||
-rw-r--r-- | model/utils.go | 1 | ||||
-rw-r--r-- | web/react/components/get_link_modal.jsx | 23 | ||||
-rw-r--r-- | web/react/components/navbar_dropdown.jsx | 2 |
5 files changed, 17 insertions, 17 deletions
diff --git a/model/search_params.go b/model/search_params.go index 9a7406a07..d31782691 100644 --- a/model/search_params.go +++ b/model/search_params.go @@ -89,9 +89,9 @@ func parseSearchFlags(input []string) ([]string, [][2]string) { } if !isFlag { - // trim off surrounding punctuation + // trim off surrounding punctuation (note that we leave trailing asterisks to allow wildcards) word = puncStart.ReplaceAllString(word, "") - word = puncEnd.ReplaceAllString(word, "") + word = puncEndWildcard.ReplaceAllString(word, "") // and remove extra pound #s word = hashtagStart.ReplaceAllString(word, "#") diff --git a/model/search_params_test.go b/model/search_params_test.go index 59eb0a113..7138d82c4 100644 --- a/model/search_params_test.go +++ b/model/search_params_test.go @@ -216,4 +216,8 @@ func TestParseSearchParams(t *testing.T) { if sp := ParseSearchParams("##hashtag +#plus+"); len(sp) != 1 || sp[0].Terms != "#hashtag #plus" || sp[0].IsHashtag != true || len(sp[0].InChannels) != 0 || len(sp[0].FromUsers) != 0 { t.Fatalf("Incorrect output from parse search params: %v", sp[0]) } + + if sp := ParseSearchParams("wildcar*"); len(sp) != 1 || sp[0].Terms != "wildcar*" || sp[0].IsHashtag != false || len(sp[0].InChannels) != 0 || len(sp[0].FromUsers) != 0 { + t.Fatalf("Incorrect output from parse search params: %v", sp[0]) + } } diff --git a/model/utils.go b/model/utils.go index 695d4a0cb..808c89e30 100644 --- a/model/utils.go +++ b/model/utils.go @@ -291,6 +291,7 @@ var validHashtag = regexp.MustCompile(`^(#[A-Za-zäöüÄÖÜß]+[A-Za-z0-9äöà var puncStart = regexp.MustCompile(`^[.,()&$!\?\[\]{}':;\\<>\-+=%^*|]+`) var hashtagStart = regexp.MustCompile(`^#{2,}`) var puncEnd = regexp.MustCompile(`[.,()&$#!\?\[\]{}':;\\<>\-+=%^*|]+$`) +var puncEndWildcard = regexp.MustCompile(`[.,()&$#!\?\[\]{}':;\\<>\-+=%^|]+$`) func ParseHashtags(text string) (string, string) { words := strings.Fields(text) diff --git a/web/react/components/get_link_modal.jsx b/web/react/components/get_link_modal.jsx index 6a5c3b588..3309d690c 100644 --- a/web/react/components/get_link_modal.jsx +++ b/web/react/components/get_link_modal.jsx @@ -41,8 +41,6 @@ export default class GetLinkModal extends React.Component { } render() { - const userCreationEnabled = global.window.mm_config.EnableUserCreation === 'true'; - let helpText = null; if (this.props.helpText) { helpText = ( @@ -55,7 +53,7 @@ export default class GetLinkModal extends React.Component { } let copyLink = null; - if (userCreationEnabled && document.queryCommandSupported('copy')) { + if (document.queryCommandSupported('copy')) { copyLink = ( <button data-copy-btn='true' @@ -71,17 +69,14 @@ export default class GetLinkModal extends React.Component { ); } - let linkText = null; - if (userCreationEnabled) { - linkText = ( - <textarea - className='form-control no-resize min-height' - readOnly='true' - ref='textarea' - value={this.props.link} - /> - ); - } + const linkText = ( + <textarea + className='form-control no-resize min-height' + readOnly='true' + ref='textarea' + value={this.props.link} + /> + ); var copyLinkConfirm = null; if (this.state.copiedLink) { diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx index e9df03c33..0ddd6ff4f 100644 --- a/web/react/components/navbar_dropdown.jsx +++ b/web/react/components/navbar_dropdown.jsx @@ -107,7 +107,7 @@ export default class NavbarDropdown extends React.Component { </li> ); - if (this.props.teamType === Constants.OPEN_TEAM) { + if (this.props.teamType === Constants.OPEN_TEAM && global.window.mm_config.EnableUserCreation === 'true') { teamLink = ( <li> <a |