Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Matrix
Commits
e5275fe8
Verified
Commit
e5275fe8
authored
1 year ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Fix lint
parent
0d26da8a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!29
Update pyproject.toml
Pipeline
#137894
passed with warnings
1 year ago
Stage: prepare
Stage: test
Stage: build
Stage: publish
Stage: docker
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/matrix/models.py
+22
-13
22 additions, 13 deletions
aleksis/apps/matrix/models.py
with
22 additions
and
13 deletions
aleksis/apps/matrix/models.py
+
22
−
13
View file @
e5275fe8
...
...
@@ -30,6 +30,13 @@ class MatrixProfile(ExtensibleModel):
change_tracker
=
FieldTracker
()
class
Meta
:
verbose_name
=
_
(
"
Matrix profile
"
)
verbose_name_plural
=
_
(
"
Matrix profiles
"
)
def
__str__
(
self
):
return
self
.
matrix_id
@classmethod
def
build_matrix_id
(
cls
,
username
:
str
,
homeserver
:
Optional
[
str
]
=
None
)
->
str
:
"""
Build a Matrix ID from a username.
"""
...
...
@@ -52,10 +59,6 @@ class MatrixProfile(ExtensibleModel):
new_profile
.
save
()
return
new_profile
class
Meta
:
verbose_name
=
_
(
"
Matrix profile
"
)
verbose_name_plural
=
_
(
"
Matrix profiles
"
)
class
MatrixRoom
(
ExtensiblePolymorphicModel
):
"""
Model for a Matrix room.
"""
...
...
@@ -71,6 +74,14 @@ class MatrixRoom(ExtensiblePolymorphicModel):
change_tracker
=
FieldTracker
([
"
group_id
"
])
class
Meta
:
verbose_name
=
_
(
"
Matrix room
"
)
verbose_name_plural
=
_
(
"
Matrix rooms
"
)
permissions
=
((
"
provision_group_in_matrix
"
,
"
Can provision group in Matrix
"
),)
def
__str__
(
self
):
return
self
.
room_id
@classmethod
def
get_queryset
(
cls
):
"""
Get a queryset for only Matrix rooms.
"""
...
...
@@ -267,17 +278,19 @@ class MatrixRoom(ExtensiblePolymorphicModel):
if
get_site_preferences
()[
"
matrix__use_spaces
"
]:
self
.
sync_space
()
class
Meta
:
verbose_name
=
_
(
"
Matrix room
"
)
verbose_name_plural
=
_
(
"
Matrix rooms
"
)
permissions
=
((
"
provision_group_in_matrix
"
,
"
Can provision group in Matrix
"
),)
class
MatrixSpace
(
MatrixRoom
):
children
=
models
.
ManyToManyField
(
to
=
MatrixRoom
,
verbose_name
=
_
(
"
Child rooms/spaces
"
),
blank
=
True
,
related_name
=
"
parents
"
)
class
Meta
:
verbose_name
=
_
(
"
Matrix space
"
)
verbose_name_plural
=
_
(
"
Matrix spaces
"
)
def
__str__
(
self
):
return
self
.
room_id
@classmethod
def
get_queryset
(
cls
):
"""
Get a queryset with only Matrix spaces.
"""
...
...
@@ -355,7 +368,3 @@ class MatrixSpace(MatrixRoom):
self
.
ensure_children
()
self
.
sync_children
()
self
.
sync_profiles
()
class
Meta
:
verbose_name
=
_
(
"
Matrix space
"
)
verbose_name_plural
=
_
(
"
Matrix spaces
"
)
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