Search for username in compose mode

This commit is contained in:
Scott Nonnenberg 2021-11-11 17:17:29 -08:00 committed by GitHub
parent 6731cc6629
commit cbae7f8ee9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 997 additions and 72 deletions

View file

@ -2043,7 +2043,7 @@ export default class MessageSender {
profileKeyCredentialRequest?: string;
userLanguages: ReadonlyArray<string>;
}>
): Promise<ReturnType<WebAPIType['getProfile']>> {
): ReturnType<WebAPIType['getProfile']> {
const { accessKey } = options;
if (accessKey) {
@ -2057,6 +2057,12 @@ export default class MessageSender {
return this.server.getProfile(number, options);
}
async getProfileForUsername(
username: string
): ReturnType<WebAPIType['getProfileForUsername']> {
return this.server.getProfileForUsername(username);
}
async getUuidsForE164s(
numbers: ReadonlyArray<string>
): Promise<Dictionary<UUIDStringType | null>> {

View file

@ -770,6 +770,7 @@ export type WebAPIType = {
userLanguages: ReadonlyArray<string>;
}
) => Promise<ProfileType>;
getProfileForUsername: (username: string) => Promise<ProfileType>;
getProfileUnauth: (
identifier: string,
options: {
@ -1077,6 +1078,7 @@ export function initialize({
getKeysForIdentifierUnauth,
getMyKeys,
getProfile,
getProfileForUsername,
getProfileUnauth,
getBadgeImageFile,
getProvisioningResource,
@ -1385,6 +1387,12 @@ export function initialize({
})) as ProfileType;
}
async function getProfileForUsername(usernameToFetch: string) {
return getProfile(`username/${usernameToFetch}`, {
userLanguages: [],
});
}
async function putProfile(
jsonData: ProfileRequestDataType
): Promise<UploadAvatarHeadersType | undefined> {