Changeset 0.24.0 (#156)
This commit is contained in:
@@ -219,16 +219,30 @@ const ChannelModels = {
|
||||
|| firstName.startsWith(partial);
|
||||
});
|
||||
|
||||
// v0.23.2: Include users in autocomplete (after personas, before models)
|
||||
const userMatches = (App.users || []).filter(u => {
|
||||
// v0.24.0: Context-aware user autocomplete.
|
||||
// direct / dm : no users (1:1 AI or already-defined human pair)
|
||||
// group : participants only (defined roster)
|
||||
// channel : full user list (open, ad-hoc)
|
||||
const activeType = App.activeType || 'direct';
|
||||
let userPool = [];
|
||||
if (activeType === 'channel') {
|
||||
userPool = App.users || [];
|
||||
} else if (activeType === 'group') {
|
||||
const pids = App.activeParticipants || [];
|
||||
userPool = (App.users || []).filter(u => pids.includes(u.id));
|
||||
}
|
||||
// direct and dm: userPool stays empty
|
||||
|
||||
const userMatches = userPool.filter(u => {
|
||||
const uhandle = (u.handle || '').toLowerCase();
|
||||
const uname = u.username.toLowerCase();
|
||||
const dname = (u.displayName || '').toLowerCase();
|
||||
if (partial.length === 0) return true;
|
||||
return uname.startsWith(partial) || dname.startsWith(partial);
|
||||
return uhandle.startsWith(partial) || uname.startsWith(partial) || dname.startsWith(partial);
|
||||
}).map(u => ({
|
||||
id: u.username,
|
||||
id: u.handle || u.username,
|
||||
name: u.displayName || u.username,
|
||||
baseModelId: u.username,
|
||||
baseModelId: u.handle || u.username,
|
||||
isPersona: false,
|
||||
isUser: true,
|
||||
personaHandle: null,
|
||||
|
||||
Reference in New Issue
Block a user