diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-07-31 10:18:26 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-07-31 10:18:26 -0400 |
commit | 8729119d4baa6a9c7f27314b175b67dc3693ebdd (patch) | |
tree | e562a499b95111eb9f7a810cde2f03562da91da8 /core/js/share.js | |
parent | d66f071d3e41ce81ab80f8edd4688d3adacef96f (diff) | |
download | nextcloud-server-8729119d4baa6a9c7f27314b175b67dc3693ebdd.tar.gz nextcloud-server-8729119d4baa6a9c7f27314b175b67dc3693ebdd.zip |
Add suggestion to share with search for sharing via email
Diffstat (limited to 'core/js/share.js')
-rw-r--r-- | core/js/share.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/js/share.js b/core/js/share.js index 64fcb77c0b0..811f9007087 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -2,6 +2,7 @@ OC.Share={ SHARE_TYPE_USER:0, SHARE_TYPE_GROUP:1, SHARE_TYPE_PRIVATE_LINK:3, + SHARE_TYPE_EMAIL:4, PERMISSION_CREATE:4, PERMISSION_READ:1, PERMISSION_UPDATE:2, @@ -99,11 +100,16 @@ OC.Share={ // response(cache[search.term]); // } else { $.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getShareWith', search: search.term }, function(result) { - if (result.status == 'success') { + if (result.status == 'success' && result.data.length > 0) { response(result.data); } else { - // Suggest sharing via email - response(); + // Suggest sharing via email if valid email address + var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i); + if (pattern.test(search.term)) { + response([{label: 'Share via email: '+search.term, value: {shareType: OC.Share.SHARE_TYPE_EMAIL, shareWith: search.term}}]); + } else { + response(['No people found']); + } } }); // } |