-
Notifications
You must be signed in to change notification settings - Fork 59
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
base: dev
Are you sure you want to change the base?
Add support for profile fields (MSC4133) #869
Conversation
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.
There was a problem hiding this 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; | ||
}; | ||
|
There was a problem hiding this comment.
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
// 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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)); |
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.