Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
018f9e75
Commit
018f9e75
authored
2 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Fix event names
parent
4e5957ee
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/users/events.py
+2
-4
2 additions, 4 deletions
app/users/events.py
with
2 additions
and
4 deletions
app/users/events.py
+
2
−
4
View file @
018f9e75
...
@@ -7,7 +7,7 @@ from flask_socketio import join_room, leave_room
...
@@ -7,7 +7,7 @@ from flask_socketio import join_room, leave_room
@socketio.on
(
'
GET /users/<user_id>
'
)
@socketio.on
(
'
GET /users/<user_id>
'
)
@socketio_login_required
@socketio_login_required
def
subscribe
_user
(
user_hashid
):
def
get
_user
(
user_hashid
):
user_id
=
hashids
.
decode
(
user_hashid
)
user_id
=
hashids
.
decode
(
user_hashid
)
user
=
User
.
query
.
get
(
user_id
)
user
=
User
.
query
.
get
(
user_id
)
if
user
is
None
:
if
user
is
None
:
...
@@ -27,15 +27,13 @@ def subscribe_user(user_hashid):
...
@@ -27,15 +27,13 @@ def subscribe_user(user_hashid):
return
{
'
code
'
:
404
,
'
msg
'
:
'
Not found
'
}
return
{
'
code
'
:
404
,
'
msg
'
:
'
Not found
'
}
if
not
(
user
==
current_user
or
current_user
.
is_administrator
):
if
not
(
user
==
current_user
or
current_user
.
is_administrator
):
return
{
'
code
'
:
403
,
'
msg
'
:
'
Forbidden
'
}
return
{
'
code
'
:
403
,
'
msg
'
:
'
Forbidden
'
}
# dict_user = user.to_dict(backrefs=True, relationships=True)
join_room
(
f
'
/users/
{
user
.
hashid
}
'
)
join_room
(
f
'
/users/
{
user
.
hashid
}
'
)
# return {'code': 200, 'msg': 'OK', 'payload': dict_user}
return
{
'
code
'
:
200
,
'
msg
'
:
'
OK
'
}
return
{
'
code
'
:
200
,
'
msg
'
:
'
OK
'
}
@socketio.on
(
'
UNSUBSCRIBE /users/<user_id>
'
)
@socketio.on
(
'
UNSUBSCRIBE /users/<user_id>
'
)
@socketio_login_required
@socketio_login_required
def
subscribe_user
(
user_hashid
):
def
un
subscribe_user
(
user_hashid
):
user_id
=
hashids
.
decode
(
user_hashid
)
user_id
=
hashids
.
decode
(
user_hashid
)
user
=
User
.
query
.
get
(
user_id
)
user
=
User
.
query
.
get
(
user_id
)
if
user
is
None
:
if
user
is
None
:
...
...
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