aboutsummaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-10-19 14:40:28 +0200
committerGitHub <noreply@github.com>2022-10-19 14:40:28 +0200
commitc3b2e44392e7f6c9a77a46664788c0bb9a6f33cb (patch)
tree6fe65807cd30770951ede4396a149ce03fb56b96 /web_src
parent7d1aed83f4d0cdf096ec8758ff8a85ddccf1328d (diff)
downloadgitea-c3b2e44392e7f6c9a77a46664788c0bb9a6f33cb.tar.gz
gitea-c3b2e44392e7f6c9a77a46664788c0bb9a6f33cb.zip
Add team member invite by email (#20307)
Allows to add (not registered) team members by email. related #5353 Invite by mail: ![grafik](https://user-images.githubusercontent.com/1666336/178154779-adcc547f-c0b7-4a2a-a131-4e41a3d9d3ad.png) Pending invitations: ![grafik](https://user-images.githubusercontent.com/1666336/178154882-9d739bb8-2b04-46c1-a025-c1f4be26af98.png) Email: ![grafik](https://user-images.githubusercontent.com/1666336/178164716-f2f90893-7ba6-4a5e-a3db-42538a660258.png) Join form: ![grafik](https://user-images.githubusercontent.com/1666336/178154840-aaab983a-d922-4414-b01a-9b1a19c5cef7.png) Co-authored-by: Jack Hay <jjphay@gmail.com>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/comp/SearchUserBox.js15
-rw-r--r--web_src/less/_organization.less5
2 files changed, 19 insertions, 1 deletions
diff --git a/web_src/js/features/comp/SearchUserBox.js b/web_src/js/features/comp/SearchUserBox.js
index 08f97595af..46ecb8ebf4 100644
--- a/web_src/js/features/comp/SearchUserBox.js
+++ b/web_src/js/features/comp/SearchUserBox.js
@@ -3,15 +3,20 @@ import {htmlEscape} from 'escape-goat';
const {appSubUrl} = window.config;
+const looksLikeEmailAddressCheck = /^\S+@\S+$/;
+
export function initCompSearchUserBox() {
const $searchUserBox = $('#search-user-box');
+ const allowEmailInput = $searchUserBox.attr('data-allow-email') === 'true';
+ const allowEmailDescription = $searchUserBox.attr('data-allow-email-description');
$searchUserBox.search({
minCharacters: 2,
apiSettings: {
url: `${appSubUrl}/user/search?q={query}`,
onResponse(response) {
const items = [];
- const searchQueryUppercase = $searchUserBox.find('input').val().toUpperCase();
+ const searchQuery = $searchUserBox.find('input').val();
+ const searchQueryUppercase = searchQuery.toUpperCase();
$.each(response.data, (_i, item) => {
let title = item.login;
if (item.full_name && item.full_name.length > 0) {
@@ -28,6 +33,14 @@ export function initCompSearchUserBox() {
}
});
+ if (allowEmailInput && items.length === 0 && looksLikeEmailAddressCheck.test(searchQuery)) {
+ const resultItem = {
+ title: searchQuery,
+ description: allowEmailDescription
+ };
+ items.push(resultItem);
+ }
+
return {results: items};
}
},
diff --git a/web_src/less/_organization.less b/web_src/less/_organization.less
index b80739671f..c52753e29b 100644
--- a/web_src/less/_organization.less
+++ b/web_src/less/_organization.less
@@ -119,6 +119,11 @@
margin-top: -3px;
}
}
+
+ .ui.avatar {
+ width: 100%;
+ height: 100%;
+ }
}
&.members {