summary refs log tree commit diff
path: root/synapse/handlers/profile.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix undiscovered linter errors (#17166)devonh2024-05-081-3/+11
| | | | | | Linter errors are showing up in #17147 that are unrelated to that PR. The errors do not currently show up on develop. This PR aims to resolve the linter errors separately from #17147.
* Bump black from 23.10.1 to 24.2.0 (#16936)dependabot[bot]2024-03-131-3/+3
|
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-231-0/+1
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* Merge remote-tracking branch 'gitlab/clokep/license-license' into new_developErik Johnston2023-12-131-10/+16
|\
| * Update license headersPatrick Cloke2023-11-211-10/+16
| |
* | Implement MSC4069: Inhibit profile propagation (#16636)Travis Ralston2023-12-041-2/+8
|/ | | MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/4069
* Return attrs for more media repo APIs. (#16611)Patrick Cloke2023-11-091-6/+9
|
* Trim whitespace when setting display names (#16031)Mohit Rathee2023-08-011-1/+1
|
* Fix 404 on /profile when the display name is empty but not the avatar (#16012)Mathieu Velten2023-07-271-1/+1
|
* `N + 3`: Read from column `full_user_id` rather than `user_id` of tables ↵Shay2023-06-021-17/+9
| | | | `profiles` and `user_filters` (#15649)
* Clean up and clarify "Create or modify Account" Admin API documentation (#15544)Andrew Morgan2023-05-051-2/+2
|
* Factor out an `is_mine_server_name` method (#15542)Sean Quah2023-05-051-2/+2
| | | | | | | | | | | | Add an `is_mine_server_name` method, similar to `is_mine_id`. Ideally we would use this consistently, instead of sometimes comparing against `hs.hostname` and other times reaching into `hs.config.server.server_name`. Also fix a bug in the tests where `hs.hostname` would sometimes differ from `hs.config.server.server_name`. Signed-off-by: Sean Quah <seanq@matrix.org>
* Move ThirdPartyEventRules into module_api/callbacks (#15535)Andrew Morgan2023-05-041-1/+1
|
* Add column `full_user_id` to tables `profiles` and `user_filters`. (#15458)Shay2023-04-261-6/+2
|
* Refresh remote profiles that have been marked as stale, in order to fill the ↵reivilibre2023-03-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | user directory. [rei:userdirpriv] (#14756) * Scaffolding for background process to refresh profiles * Add scaffolding for background process to refresh profiles for a given server * Implement the code to select servers to refresh from * Ensure we don't build up multiple looping calls * Make `get_profile` able to respect backoffs * Add logic for refreshing users * When backing off, schedule a refresh when the backoff is over * Wake up the background processes when we receive an interesting state event * Add tests * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> * Add comment about 1<<62 --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* fix broken avatar checks when server_name contains a port (#13927)Ashish Kumar2022-10-261-1/+5
| | | | | | Fixes check_avatar_size_and_mime_type() to successfully update avatars on homeservers running on non-default ports which it would mistakenly treat as remote homeserver while validating the avatar's size and mime type. Signed-off-by: Ashish Kumar ashfame@users.noreply.github.com
* Use a single query in `ProfileHandler.get_profile` (#13209)Nick Mills-Barrett2022-07-071-12/+7
|
* Remove remaining pieces of groups code. (#12966)Patrick Cloke2022-06-061-82/+1
| | | | | * Remove an unused stream ID generator. * Remove the now unused remote profile cache.
* Always allow the empty string as an avatar_url. (#12261)David Robertson2022-03-251-0/+6
| | | | | Hopefully this fixes #12257. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Add module callbacks called for reacting to deactivation status change and ↵Brendan Abolivier2022-03-011-0/+14
| | | | profile update (#12062)
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-1/+1
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Configurable limits on avatars (#11846)Brendan Abolivier2022-01-281-0/+67
| | | | | | Only allow files which file size and content types match configured limits to be set as avatar. Most of the inspiration from the non-test code comes from matrix-org/synapse-dinsic#19
* Annotate `log_function` decorator (#10943)reivilibre2021-10-271-0/+4
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Remove the deprecated BaseHandler. (#11005)Patrick Cloke2021-10-081-5/+6
| | | | | | | | The shared ratelimit function was replaced with a dedicated RequestRatelimiter class (accessible from the HomeServer object). Other properties were copied to each sub-class that inherited from BaseHandler.
* Use direct references for configuration variables (part 7). (#10959)Patrick Cloke2021-10-041-2/+2
|
* Use direct references for configuration variables (part 6). (#10916)Patrick Cloke2021-09-291-1/+1
|
* Use direct references for configuration variables (part 4). (#10893)Patrick Cloke2021-09-231-1/+1
|
* Always add local users to the user directory (#10796)David Robertson2021-09-211-10/+8
| | | | | | | | | | | | | | | | | | | | | | | It's a simplification, but one that'll help make the user directory logic easier to follow with the other changes upcoming. It's not strictly required for those changes, but this will help simplify the resulting logic that listens for `m.room.member` events and generally make the logic easier to follow. This means the config option `search_all_users` ends up controlling the search query only, and not the data we store. The cost of doing so is an extra row in the `user_directory` and `user_directory_search` tables for each local user which - belongs to no public rooms - belongs to no private rooms of size ≥ 2 I think the cost of this will be marginal (since they'll already have entries in `users` and `profiles` anyway). As a small upside, a homeserver whose directory was built with this change can toggle `search_all_users` without having to rebuild their directory. Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Require type hints in the handlers module. (#10831)Patrick Cloke2021-09-201-2/+2
| | | | | | | Adds missing type hints to methods in the synapse.handlers module and requires all methods to have type hints there. This also removes the unused construct_auth_difference method from the FederationHandler.
* Use direct references for some configuration variables (#10798)Patrick Cloke2021-09-131-1/+1
| | | | Instead of proxying through the magic getter of the RootConfig object. This should be more performant (and is more explicit).
* Use inline type hints in `handlers/` and `rest/`. (#10382)Jonathan de Jong2021-07-161-2/+2
|
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Import HomeServer from the proper module. (#9665)Patrick Cloke2021-03-231-1/+1
|
* Fix style checking due to updated black.Patrick Cloke2021-02-191-2/+1
|
* Add configs to make profile data more private (#9203)AndrewFerr2021-02-191-0/+10
| | | | | | | Add off-by-default configuration settings to: - disable putting an invitee's profile info in invite events - disable profile lookup via federation Signed-off-by: Andrew Ferrazzutti <fair@miscworks.net>
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-1/+2
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Remove user's avatar URL and displayname when deactivated. (#8932)Dirk Klimpel2021-01-121-1/+7
| | | This only applies if the user's data is to be erased.
* Handle a display name / avatar URL not included in a federation request. (#9023)Patrick Cloke2021-01-061-2/+2
| | | | These may be omitted if not set, but Synapse assumed they would be in the response.
* Add admin API for logging in as a user (#8617)Erik Johnston2020-11-171-2/+6
|
* Improve error messages of non-str displayname/avatar_url (#8705)Andrew Morgan2020-11-021-2/+6
| | | | | | | | This PR fixes two things: * Corrects the copy/paste error of telling the client their displayname is wrong when they are submitting an `avatar_url`. * Returns a `M_INVALID_PARAM` instead of `M_UNKNOWN` for non-str type parameters. Reported by @t3chguy.
* Add type hints for account validity handler (#8620)Patrick Cloke2020-10-261-2/+2
| | | This also fixes a bug by fixing handling of an account which doesn't expire.
* Check status codes that profile handler returns (#8580)LEdoian2020-10-261-0/+7
| | | | | | | Fixes #8520 Signed-off-by: Pavel Turinsky <pavel.turinsky@matfyz.cz> Co-authored-by: Erik Johnston <erikj@jki.re>
* Fix typos and spelling errors. (#8639)Patrick Cloke2020-10-231-1/+1
|
* Add type hints to profile and base handlers. (#8609)Patrick Cloke2020-10-211-25/+49
|
* Consistently use wrap_as_background_task in more places (#8599)Patrick Cloke2020-10-201-7/+3
|
* Move additional tasks to the background worker, part 4 (#8513)Patrick Cloke2020-10-131-18/+11
|
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-181-2/+2
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Fix errors when updating the user directory with invalid data (#8223)Patrick Cloke2020-09-011-0/+6
|
* Do not propagate profile changes of shadow-banned users into rooms. (#8157)Patrick Cloke2020-08-261-2/+15
|
* Convert _base, profile, and _receipts handlers to async/await (#7860)Patrick Cloke2020-07-171-36/+27
|
* Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-161-5/+3
|
* async/await is_server_admin (#7363)Andrew Morgan2020-05-011-19/+20
|
* Add options to prevent users from changing their profile. (#7096)Dirk Klimpel2020-03-271-0/+16
|
* Revert "Add options to disable setting profile info for prevent changes. ↵Richard van der Hoff2020-03-171-16/+0
| | | | | | | (#7053)" This reverts commit 54dd28621b070ca67de9f773fe9a89e1f4dc19da, reversing changes made to 6640460d054e8f4444046a34bdf638921b31c01e.
* lint, fix testsdklimpel2020-03-091-1/+3
|
* updates after reviewdklimpel2020-03-091-4/+4
|
* lintdklimpel2020-03-081-4/+2
|
* changelogdklimpel2020-03-081-2/+8
|
* Add options to disable setting profile info for prevent changes.dklimpel2020-03-081-0/+10
|
* Change displayname of user as admin in rooms (#6876)Dirk Klimpel2020-02-211-1/+11
|
* Add option to allow profile queries without sharing a room (#6523)Will Hunt2019-12-161-1/+5
|
* Replace instance variations of homeserver with correct case/spacingAndrew Morgan2019-11-121-3/+3
|
* Remove usage of deprecated logger.warn method from codebase (#6271)Andrew Morgan2019-10-311-1/+1
| | | Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated.
* Increase max display name limitNeil Johnson2019-08-241-1/+1
|
* Replace returnValue with return (#5736)Amber Brown2019-07-231-9/+9
|
* Allow newly-registered users to lookup their own profilesBrendan Abolivier2019-07-081-0/+4
| | | | When a user creates an account and the 'require_auth_for_profile_requests' config flag is set, and a client that performed the registration wants to lookup the newly-created profile, the request will be denied because the user doesn't share a room with themselves yet.
* Run Black. (#5482)Amber Brown2019-06-201-46/+19
|
* Handle HttpResponseException when using federation client.Erik Johnston2019-06-071-13/+16
| | | | Otherwise we just log exceptions everywhere.
* Limit displaynames and avatar URLsRichard van der Hoff2019-06-011-0/+13
| | | | | | These end up in join events everywhere, so let's limit them. Fixes #5079
* add options to require an access_token to GET /profile and /publicRooms on ↵Matthew Hodgson2019-05-081-0/+43
| | | | | | | | | | | | | | | | | CS API (#5083) This commit adds two config options: * `restrict_public_rooms_to_local_users` Requires auth to fetch the public rooms directory through the CS API and disables fetching it through the federation API. * `require_auth_for_profile_requests` When set to `true`, requires that requests to `/profile` over the CS API are authenticated, and only returns the user's profile if the requester shares a room with the profile's owner, as per MSC1301. MSC1301 also specifies a behaviour for federation (only returning the profile if the server asking for it shares a room with the profile's owner), but that's currently really non-trivial to do in a not too expensive way. Next step is writing down a MSC that allows a HS to specify which user sent the profile query. In this implementation, Synapse won't send a profile query over federation if it doesn't believe it already shares a room with the profile's owner, though. Groups have been intentionally omitted from this commit.
* Support 3PID login in password providers (#4931)Andrew Morgan2019-03-261-2/+8
| | | | | Adds a new method, check_3pid_auth, which gives password providers the chance to allow authentication with third-party identifiers such as email or msisdn.
* Fix exception handling in fetching remote profilesErik Johnston2018-10-031-6/+2
|
* Replaced all occurences of e.message with str(e)Schnuffle2018-09-271-1/+1
| | | | Signed-off-by: Schnuffle <schnuffle@github.com>
* Rename WorkerProfileHandler to BaseProfileHandlerErik Johnston2018-08-221-3/+10
|
* Add assert to ensure handler is only run on masterErik Johnston2018-08-221-0/+2
|
* Remove redundant varsErik Johnston2018-08-221-3/+0
|
* Call UserDirectoryHandler methods directlyErik Johnston2018-08-171-21/+5
| | | | | | | | Turns out that the user directory handling is fairly racey as a bunch of stuff assumes that the processing happens on master, which it doesn't when there is a synapse.app.user_dir worker. So lets just call the function directly until we actually get round to fixing it, since it doesn't make the situation any worse.
* Split ProfileHandler into master and workerErik Johnston2018-08-171-7/+14
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-08-091-31/+58
|\ | | | | | | erikj/split_profiles
| * Return M_NOT_FOUND when a profile could not be found. (#3596)Will Hunt2018-08-031-31/+58
| |
* | Allow profile changes to happen on workersErik Johnston2018-08-071-5/+21
|/
* Fix some looping_call calls which were broken in #3604Richard van der Hoff2018-07-261-1/+1
| | | | | | | | | It turns out that looping_call does check the deferred returned by its callback, and (at least in the case of client_ips), we were relying on this, and I broke it in #3604. Update run_as_background_process to return the deferred, and make sure we return it to clock.looping_call.
* Fix updating of cached remote profilesRichard van der Hoff2018-07-251-1/+8
| | | | | | _update_remote_profile_cache was missing its `defer.inlineCallbacks`, so when it was called, would just return a generator object, without actually running any of the method body.
* run isortAmber Brown2018-07-091-1/+2
|
* Only update remote profile cache on masterErik Johnston2018-03-131-1/+4
|
* s/replication_client/federation_client/Erik Johnston2018-03-131-1/+1
|
* Split replication layer into twoErik Johnston2018-03-131-1/+1
|
* Split out edu/query registration to a separate classErik Johnston2018-03-131-1/+1
|
* Move RoomMemberHandler out of HandlersErik Johnston2018-03-011-1/+1
|
* fix pep8 and testsMatthew Hodgson2017-12-041-1/+1
|
* switch to a simpler 'search_all_users' button as per review feedbackMatthew Hodgson2017-12-041-2/+2
|
* untested WIP but might actually workMatthew Hodgson2017-11-291-0/+14
|
* removed unused import flagged by flake8aFrancois Granade2017-11-031-1/+0
|
* Fix for issue 2635: correctly update rooms avatar/display name when modified ↵Francois Granade2017-11-031-12/+8
| | | | by admin
* replace 'except:' with 'except Exception:'Richard van der Hoff2017-10-231-3/+3
| | | | what could possibly go wrong
* Add user profiles to summary from group serverErik Johnston2017-08-251-0/+23
|
* Fix typos and reinheritErik Johnston2017-08-251-12/+6
|
* Split out profile handler to fix testsErik Johnston2017-08-251-5/+8
|
* Add remote profile cacheErik Johnston2017-08-251-1/+80
|
* Add per user ratelimiting overridesErik Johnston2017-05-101-1/+1
|
* Ignore backoff history for invites, aliases, and roomdirsRichard van der Hoff2017-03-231-2/+4
| | | | | Add a param to the federation client which lets us ignore historical backoff data for federation queries, and set it for a handful of operations.
* Don't recreate so many setsErik Johnston2017-03-161-4/+4
|
* handlers/profile: added admin override for set_displayname and set_avatar_urlPatrik Oldsberg2016-10-061-4/+4
| | | | Signed-off-by: Patrik Oldsberg <patrik.oldsberg@ericsson.com>
* Add `create_requester` functionRichard van der Hoff2016-07-261-5/+7
| | | | | Wrap the `Requester` constructor with a function which provides sensible defaults, and use it throughout
* Remove registered_users from the distributor.Mark Haines2016-06-171-7/+0
| | | | | | | | | | The only place that was observed was to set the profile. I've made it so that the profile is set within store.register in the same transaction that creates the user. This required some slight changes to the registration code for upgrading guest users, since it previously relied on the distributor swallowing errors if the profile already existed.
* changed_presencelike_data isn't observed anywhere in synapse so can be removedMark Haines2016-04-081-15/+0
|
* Call profile handler get_displayname directly rather than using ↵Mark Haines2016-04-071-28/+0
| | | | collect_presencelike_data
* Pass whole requester to ratelimitingDaniel Wagner-Hall2016-03-031-8/+9
| | | | This will enable more detailed decisions
* Merge pull request #582 from matrix-org/erikj/presenceErik Johnston2016-02-191-0/+3
|\ | | | | Rewrite presence for performance.
| * Initial cutErik Johnston2016-02-171-0/+3
| |
* | Add commentDaniel Wagner-Hall2016-02-161-1/+1
| |
* | Use update_membership for profile updatesDaniel Wagner-Hall2016-02-151-16/+12
|/
* Revert "Merge two of the room join codepaths"Daniel Wagner-Hall2016-02-121-9/+2
| | | | | | This reverts commit cf81375b94c4763766440471e632fc4b103450ab. It subtly violates a guest joining auth check
* Merge two of the room join codepathsDaniel Wagner-Hall2016-02-121-2/+9
| | | | | | | | | | | | | There's at least one more to merge in. Side-effects: * Stop reporting None as displayname and avatar_url in some cases * Joining a room by alias populates guest-ness in join event * Remove unspec'd PUT version of /join/<room_id_or_alias> which has not been called on matrix.org according to logs * Stop recording access_token_id on /join/room_id - currently we don't record it on /join/room_alias; I can try to thread it through at some point.
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Wrap calls to distributor.fire in appropriately named functions so that ↵Mark Haines2015-12-011-13/+15
| | | | static analysis can work out want is calling what
* Treat setting your display name to the empty string as removing it (SYN-186).David Baker2015-05-141-0/+3
|
* Unwrap defer.gatherResults failuresErik Johnston2015-05-121-1/+2
|
* PEP8Erik Johnston2015-05-081-1/+0
|
* Change the way we do logging contexts so that they survive divergencesErik Johnston2015-05-081-8/+7
|
* Change room handlers get_rooms_for_user to get_joined_rooms_for_user. This ↵Erik Johnston2015-03-091-2/+1
| | | | uses the a storage api that is cached.
* When setting display name more graciously handle failures to update room state.Erik Johnston2015-03-061-7/+13
|
* Replace hs.parse_userid with UserID.from_stringMark Haines2015-01-231-1/+2
|
* Merge branch 'erikj-perf' of github.com:matrix-org/synapse into developErik Johnston2015-01-061-5/+5
|\
| * We don't need the full events for get_rooms_for_user_where_membership_isErik Johnston2015-01-061-5/+5
| |
* | Update copyright noticesMark Haines2015-01-061-1/+1
|/
* Rate limit display names and avatar urls per request rather than per event.Kegan Dougal2014-12-191-2/+4
|
* Rename MessageHandler.handle_event. Add a few comments.Erik Johnston2014-12-151-1/+1
|
* Remove unused snapshotErik Johnston2014-12-091-2/+0
|
* Convert rest and handlers to use new event structureErik Johnston2014-12-041-11/+8
|
* Change DomainSpecificString so that it doesn't use a HomeServer objectErik Johnston2014-12-021-7/+7
|
* Add a few missing yields, Move deferred lists inside PreserveLoggingContext ↵Mark Haines2014-11-201-8/+10
| | | | because they don't interact well with the logging contexts
* Don't add a 'prev' key to m.room.member messagesErik Johnston2014-11-191-1/+0
|
* Add an EventValidator. Fix bugs in auth ++ storageErik Johnston2014-11-101-4/+7
|
* Implement new replace_state and changed prev_stateErik Johnston2014-11-061-5/+1
| | | | | `prev_state` is now a list of previous state ids, similiar to prev_events. `replace_state` now points to what we think was replaced.
* Begin making auth use event.old_state_eventsErik Johnston2014-10-151-2/+3
|
* SYN-40: When a user updates their displayname or avatar update all their ↵Erik Johnston2014-09-171-3/+43
| | | | join events for all the rooms they are currently in.
* fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org ↵Matthew Hodgson2014-09-031-1/+1
| | | | hasn't been incorporated in time for launch.
* Now that HS->HS Profile lookups use Federation Queries, we don't need the ↵Paul "LeoNerd" Evans2014-08-131-8/+4
| | | | 'local_only' antirecursion hack
* Use new Federation Query API to implement HS->HS fetching of remote users' ↵Paul "LeoNerd" Evans2014-08-131-25/+41
| | | | profile information instead of (ab)using the client-side REST API
* add in whitespace after copyright statements to improve legibilityMatthew Hodgson2014-08-131-0/+1
|
* Reference Matrix Home Servermatrix.org2014-08-121-0/+169