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
Package registry
Container Registry
Model registry
Operate
Terraform modules
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
Timo Ley
synapse
Commits
9a84d744
Commit
9a84d744
authored
5 years ago
by
Michael Telatynski
Committed by
Richard van der Hoff
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
before fulfilling a group invite,check if user is already joined/invited (#3436)
Fixes vector-im/riot-web#5645
parent
2efd050c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/3436.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/3436.bugfix
synapse/groups/groups_server.py
+16
-4
16 additions, 4 deletions
synapse/groups/groups_server.py
with
17 additions
and
4 deletions
changelog.d/3436.bugfix
0 → 100644
+
1
−
0
View file @
9a84d744
Fix a problem where users could be invited twice to the same group.
This diff is collapsed.
Click to expand it.
synapse/groups/groups_server.py
+
16
−
4
View file @
9a84d744
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# Copyright 2017 Vector Creations Ltd
# Copyright 2017 Vector Creations Ltd
# Copyright 2018 New Vector Ltd
# Copyright 2018 New Vector Ltd
# Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -20,16 +21,16 @@ from six import string_types
...
@@ -20,16 +21,16 @@ from six import string_types
from
twisted.internet
import
defer
from
twisted.internet
import
defer
from
synapse.api.errors
import
SynapseError
from
synapse.api.errors
import
Codes
,
SynapseError
from
synapse.types
import
GroupID
,
RoomID
,
UserID
,
get_domain_from_id
from
synapse.types
import
GroupID
,
RoomID
,
UserID
,
get_domain_from_id
from
synapse.util.async_helpers
import
concurrently_execute
from
synapse.util.async_helpers
import
concurrently_execute
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
# TODO: Allow users to "knock" or simp
k
ly join depending on rules
# TODO: Allow users to "knock" or simply join depending on rules
# TODO: Federation admin APIs
# TODO: Federation admin APIs
# TODO: is_priveged flag to users and is_public to users and rooms
# TODO: is_priv
il
eged flag to users and is_public to users and rooms
# TODO: Audit log for admins (profile updates, membership changes, users who tried
# TODO: Audit log for admins (profile updates, membership changes, users who tried
# to join but were rejected, etc)
# to join but were rejected, etc)
# TODO: Flairs
# TODO: Flairs
...
@@ -590,7 +591,18 @@ class GroupsServerHandler(object):
...
@@ -590,7 +591,18 @@ class GroupsServerHandler(object):
)
)
# TODO: Check if user knocked
# TODO: Check if user knocked
# TODO: Check if user is already invited
invited_users
=
yield
self
.
store
.
get_invited_users_in_group
(
group_id
)
if
user_id
in
invited_users
:
raise
SynapseError
(
400
,
"
User already invited to group
"
,
errcode
=
Codes
.
BAD_STATE
)
user_results
=
yield
self
.
store
.
get_users_in_group
(
group_id
,
include_private
=
True
)
if
user_id
in
[
user_result
[
"
user_id
"
]
for
user_result
in
user_results
]:
raise
SynapseError
(
400
,
"
User already in group
"
)
content
=
{
content
=
{
"
profile
"
:
{
"
name
"
:
group
[
"
name
"
],
"
avatar_url
"
:
group
[
"
avatar_url
"
]},
"
profile
"
:
{
"
name
"
:
group
[
"
name
"
],
"
avatar_url
"
:
group
[
"
avatar_url
"
]},
...
...
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