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
851aeae7
Commit
851aeae7
authored
7 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Check users/rooms are in group before adding to summary
parent
d5e32c84
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/storage/group_server.py
+25
-0
25 additions, 0 deletions
synapse/storage/group_server.py
with
25 additions
and
0 deletions
synapse/storage/group_server.py
+
25
−
0
View file @
851aeae7
...
@@ -152,6 +152,18 @@ class GroupServerStore(SQLBaseStore):
...
@@ -152,6 +152,18 @@ class GroupServerStore(SQLBaseStore):
an order of 1 will put the room first. Otherwise, the room gets
an order of 1 will put the room first. Otherwise, the room gets
added to the end.
added to the end.
"""
"""
room_in_group
=
self
.
_simple_select_one_onecol_txn
(
txn
,
table
=
"
group_rooms
"
,
keyvalues
=
{
"
group_id
"
:
group_id
,
"
room_id
"
:
room_id
,
},
retcol
=
"
room_id
"
,
allow_none
=
True
,
)
if
not
room_in_group
:
raise
SynapseError
(
400
,
"
room not in group
"
)
if
category_id
is
None
:
if
category_id
is
None
:
category_id
=
_DEFAULT_CATEGORY_ID
category_id
=
_DEFAULT_CATEGORY_ID
...
@@ -426,6 +438,19 @@ class GroupServerStore(SQLBaseStore):
...
@@ -426,6 +438,19 @@ class GroupServerStore(SQLBaseStore):
an order of 1 will put the user first. Otherwise, the user gets
an order of 1 will put the user first. Otherwise, the user gets
added to the end.
added to the end.
"""
"""
user_in_group
=
self
.
_simple_select_one_onecol_txn
(
txn
,
table
=
"
group_users
"
,
keyvalues
=
{
"
group_id
"
:
group_id
,
"
user_id
"
:
user_id
,
},
retcol
=
"
user_id
"
,
allow_none
=
True
,
)
if
not
user_in_group
:
raise
SynapseError
(
400
,
"
user not in group
"
)
if
role_id
is
None
:
if
role_id
is
None
:
role_id
=
_DEFAULT_ROLE_ID
role_id
=
_DEFAULT_ROLE_ID
else
:
else
:
...
...
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