mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
Add Test to opt out of username being searchable
This commit is contained in:
@@ -66,6 +66,9 @@
|
||||
.checkbox
|
||||
input(type='checkbox', v-model='user.preferences.suppressModals.streak', @change='set("suppressModals", "streak")')
|
||||
label {{ $t('suppressStreakModal') }}
|
||||
.checkbox
|
||||
input(type='checkbox', v-model='user.preferences.searchableUsername', @change='set("searchableUsername")')
|
||||
label {{ $t('searchableUsernameSetting') }}
|
||||
//- .checkbox
|
||||
//- label {{ $t('confirmScoreNotes') }}
|
||||
//- input(type='checkbox', v-model='user.preferences.tasks.confirmScoreNotes', @change='set({"preferences.tasks.confirmScoreNotes": user.preferences.tasks.confirmScoreNotes ? true: false})')
|
||||
|
||||
@@ -206,5 +206,7 @@
|
||||
"usernameVerifiedConfirmation": "Your username, <%= username %>, is confirmed!",
|
||||
"usernameNotVerified": "Please confirm your username.",
|
||||
"changeUsernameDisclaimer": "We will be transitioning login names to unique, public usernames soon. This username will be used for invitations, @mentions in chat, and messaging.",
|
||||
"verifyUsernameVeteranPet": "One of these Veteran Pets will be waiting for you after you've finished confirming!"
|
||||
"verifyUsernameVeteranPet": "One of these Veteran Pets will be waiting for you after you've finished confirming!",
|
||||
"searchableUsernameSetting": "Allow username to appear in searches",
|
||||
"searchableUsernamePopover": "If enabled, other users can @mention and invite you easier."
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ api.getUsernameAutocompletes = {
|
||||
let username = req.params.username.toLowerCase();
|
||||
if (username[0] === '@') username = username.slice(1, username.length);
|
||||
|
||||
if (username.length < 2) {
|
||||
if (username.length < 1) {
|
||||
res.respond(200, []);
|
||||
return;
|
||||
}
|
||||
|
||||
let members = await User
|
||||
.find({'auth.local.lowerCaseUsername': {$regex: `.*${username}.*`}, 'flags.verifiedUsername': true})
|
||||
.find({'auth.local.lowerCaseUsername': {$regex: `.*${username}.*`}, 'flags.verifiedUsername': true, 'preferences.searchableUsername': {$ne: false}})
|
||||
.select(['profile.name', 'contributor', 'auth.local.username'])
|
||||
.limit(20)
|
||||
.exec();
|
||||
|
||||
@@ -460,6 +460,7 @@ let schema = new Schema({
|
||||
reverseChatOrder: {$type: Boolean, default: false},
|
||||
background: String,
|
||||
displayInviteToPartyWhenPartyIs1: {$type: Boolean, default: true},
|
||||
searchableUsername: {$type: Boolean, default: true},
|
||||
webhooks: {$type: Schema.Types.Mixed, default: () => {
|
||||
return {};
|
||||
}},
|
||||
|
||||
Reference in New Issue
Block a user