Skip to content

Add support for profile fields (MSC4133) #869

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

redstrate
Copy link
Contributor

This adds support for the now-somewhat-supported but still unstable MSC for profile fields. Mostly consisting of jobs for clients, some capability support and logic for determining whether a profile field is supported or not.

This adds support for the now-somewhat-supported but still unstable MSC
for profile fields. Mostly consisting of jobs for clients, some
capability support and logic for determining whether a profile field is
supported or not.
Copy link
Member

@KitsuneRal KitsuneRal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks; but let's wait for matrix-org/matrix-spec#2071

//! A list of disallowed profile field keys.
QList<QString> disallowed;
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contents of csapi/ are generated from API definitions (see CODE_GENERATION.md) - I understand it makes the whole process a bit more tedious but I'd rather wait for matrix-org/matrix-spec#2071 to get merged and then we're going to get those definitions "for free", just by virtue of rebasing the main branch in https://github.com/quotient-im/matrix-spec

Comment on lines +1983 to +1998
// If the capability is missing, assume we are allowed to edit any profile field
if (!d->capabilities.profileFields) {
return true;
}

// If it's explicitly in the allow list
if (d->capabilities.profileFields->allowed.contains(key)) {
return true;
}

// As long as it's not explicitly disallowed
if (d->capabilities.profileFields->disallowed.contains(key)) {
return false;
}

return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// If the capability is missing, assume we are allowed to edit any profile field
if (!d->capabilities.profileFields) {
return true;
}
// If it's explicitly in the allow list
if (d->capabilities.profileFields->allowed.contains(key)) {
return true;
}
// As long as it's not explicitly disallowed
if (d->capabilities.profileFields->disallowed.contains(key)) {
return false;
}
return true;
// If the capability is missing, assume we are allowed to edit any profile field; otherwise,
// it should either be explicitly allowed or NOT explicitly disallowed
return (!d->capabilities.profileFields || d->capabilities.profileFields->allowed.contains(key))
&& !d->capabilities.profileFields->disallowed.contains(key));

@KitsuneRal KitsuneRal added the enhancement A feature or change request for the library label Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature or change request for the library
Projects
Status: In work
Development

Successfully merging this pull request may close these issues.

2 participants