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
429925a5
"src/git@mau.dev:june/conduwuit.git" did not exist on "158de10fe6582b2fe3fa3e45c60edfe1626f14c0"
Commit
429925a5
authored
7 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Lift out visibility parsing
parent
83936293
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/groups/groups_server.py
+21
-20
21 additions, 20 deletions
synapse/groups/groups_server.py
with
21 additions
and
20 deletions
synapse/groups/groups_server.py
+
21
−
20
View file @
429925a5
...
@@ -175,16 +175,7 @@ class GroupsServerHandler(object):
...
@@ -175,16 +175,7 @@ class GroupsServerHandler(object):
# TODO: Check if room has already been added
# TODO: Check if room has already been added
visibility
=
content
.
get
(
"
visibility
"
)
is_public
=
_parse_visibility_from_contents
(
content
)
if
visibility
:
vis_type
=
visibility
[
"
type
"
]
if
vis_type
not
in
(
"
public
"
,
"
private
"
):
raise
SynapseError
(
400
,
"
Synapse only supports
'
public
'
/
'
private
'
visibility
"
)
is_public
=
vis_type
==
"
public
"
else
:
is_public
=
True
yield
self
.
store
.
add_room_to_group
(
group_id
,
room_id
,
is_public
=
is_public
)
yield
self
.
store
.
add_room_to_group
(
group_id
,
room_id
,
is_public
=
is_public
)
...
@@ -285,16 +276,7 @@ class GroupsServerHandler(object):
...
@@ -285,16 +276,7 @@ class GroupsServerHandler(object):
local_attestation
=
self
.
attestations
.
create_attestation
(
group_id
,
user_id
)
local_attestation
=
self
.
attestations
.
create_attestation
(
group_id
,
user_id
)
visibility
=
content
.
get
(
"
visibility
"
)
is_public
=
_parse_visibility_from_contents
(
content
)
if
visibility
:
vis_type
=
visibility
[
"
type
"
]
if
vis_type
not
in
(
"
public
"
,
"
private
"
):
raise
SynapseError
(
400
,
"
Synapse only supports
'
public
'
/
'
private
'
visibility
"
)
is_public
=
vis_type
==
"
public
"
else
:
is_public
=
True
yield
self
.
store
.
add_user_to_group
(
yield
self
.
store
.
add_user_to_group
(
group_id
,
user_id
,
group_id
,
user_id
,
...
@@ -412,3 +394,22 @@ class GroupsServerHandler(object):
...
@@ -412,3 +394,22 @@ class GroupsServerHandler(object):
defer
.
returnValue
({
defer
.
returnValue
({
"
group_id
"
:
group_id
,
"
group_id
"
:
group_id
,
})
})
def
_parse_visibility_from_contents
(
content
):
"""
Given a content for a request parse out whether the entity should be
public or not
"""
visibility
=
content
.
get
(
"
visibility
"
)
if
visibility
:
vis_type
=
visibility
[
"
type
"
]
if
vis_type
not
in
(
"
public
"
,
"
private
"
):
raise
SynapseError
(
400
,
"
Synapse only supports
'
public
'
/
'
private
'
visibility
"
)
is_public
=
vis_type
==
"
public
"
else
:
is_public
=
True
return
is_public
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