Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
5c778f2f
Commit
5c778f2f
authored
10 years ago
by
David Baker
Browse files
Options
Downloads
Patches
Plain Diff
Add rest endpoint for the whole user profile
parent
fdcb8764
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/rest/profile.py
+21
-0
21 additions, 0 deletions
synapse/rest/profile.py
with
21 additions
and
0 deletions
synapse/rest/profile.py
+
21
−
0
View file @
5c778f2f
...
@@ -21,6 +21,26 @@ from base import RestServlet, client_path_pattern
...
@@ -21,6 +21,26 @@ from base import RestServlet, client_path_pattern
import
json
import
json
class
ProfileRestServlet
(
RestServlet
):
PATTERN
=
client_path_pattern
(
"
/profile/(?P<user_id>[^/]*)
"
)
@defer.inlineCallbacks
def
on_GET
(
self
,
request
,
user_id
):
user
=
self
.
hs
.
parse_userid
(
user_id
)
displayname
=
yield
self
.
handlers
.
profile_handler
.
get_displayname
(
user
,
)
avatar_url
=
yield
self
.
handlers
.
profile_handler
.
get_avatar_url
(
user
,
)
defer
.
returnValue
((
200
,
{
"
displayname
"
:
displayname
,
"
avatar_url
"
:
avatar_url
}))
class
ProfileDisplaynameRestServlet
(
RestServlet
):
class
ProfileDisplaynameRestServlet
(
RestServlet
):
PATTERN
=
client_path_pattern
(
"
/profile/(?P<user_id>[^/]*)/displayname
"
)
PATTERN
=
client_path_pattern
(
"
/profile/(?P<user_id>[^/]*)/displayname
"
)
...
@@ -88,5 +108,6 @@ class ProfileAvatarURLRestServlet(RestServlet):
...
@@ -88,5 +108,6 @@ class ProfileAvatarURLRestServlet(RestServlet):
def
register_servlets
(
hs
,
http_server
):
def
register_servlets
(
hs
,
http_server
):
ProfileRestServlet
(
hs
).
register
(
http_server
)
ProfileDisplaynameRestServlet
(
hs
).
register
(
http_server
)
ProfileDisplaynameRestServlet
(
hs
).
register
(
http_server
)
ProfileAvatarURLRestServlet
(
hs
).
register
(
http_server
)
ProfileAvatarURLRestServlet
(
hs
).
register
(
http_server
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment