Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
019f3659
Commit
019f3659
authored
Oct 30, 2021
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove accessors for group description fields.
Consult the description directly.
parent
06ee4cc3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
39 deletions
+10
-39
group/group.go
group/group.go
+6
-23
group/group_test.go
group/group_test.go
+0
-12
rtpconn/webclient.go
rtpconn/webclient.go
+3
-3
webserver/webserver.go
webserver/webserver.go
+1
-1
No files found.
group/group.go
View file @
019f3659
...
...
@@ -106,28 +106,10 @@ func (g *Group) SetLocked(locked bool, message string) {
}
}
func
(
g
*
Group
)
Public
()
bool
{
func
(
g
*
Group
)
Description
()
*
Description
{
g
.
mu
.
Lock
()
defer
g
.
mu
.
Unlock
()
return
g
.
description
.
Public
}
func
(
g
*
Group
)
Redirect
()
string
{
g
.
mu
.
Lock
()
defer
g
.
mu
.
Unlock
()
return
g
.
description
.
Redirect
}
func
(
g
*
Group
)
AllowRecording
()
bool
{
g
.
mu
.
Lock
()
defer
g
.
mu
.
Unlock
()
return
g
.
description
.
AllowRecording
}
func
(
g
*
Group
)
DisplayName
()
string
{
g
.
mu
.
Lock
()
defer
g
.
mu
.
Unlock
()
return
g
.
description
.
DisplayName
return
g
.
description
}
func
(
g
*
Group
)
EmptyTime
()
time
.
Duration
{
...
...
@@ -1021,12 +1003,13 @@ type Public struct {
func
GetPublic
()
[]
Public
{
gs
:=
make
([]
Public
,
0
)
Range
(
func
(
g
*
Group
)
bool
{
if
g
.
Public
()
{
desc
:=
g
.
Description
()
if
desc
.
Public
{
locked
,
_
:=
g
.
Locked
()
gs
=
append
(
gs
,
Public
{
Name
:
g
.
name
,
DisplayName
:
g
.
DisplayName
()
,
Description
:
g
.
description
.
Description
,
DisplayName
:
desc
.
DisplayName
,
Description
:
desc
.
Description
,
Locked
:
locked
,
ClientCount
:
len
(
g
.
clients
),
})
...
...
group/group_test.go
View file @
019f3659
...
...
@@ -29,18 +29,6 @@ func TestGroup(t *testing.T) {
if
locked
,
_
:=
g
.
Locked
();
locked
{
t
.
Errorf
(
"Locked: expected false, got %v"
,
locked
)
}
if
public
:=
g
.
Public
();
public
{
t
.
Errorf
(
"Public: expected false, got %v"
,
public
)
}
if
public
:=
g2
.
Public
();
!
public
{
t
.
Errorf
(
"Public: expected true, got %v"
,
public
)
}
if
redirect
:=
g
.
Redirect
();
redirect
!=
""
{
t
.
Errorf
(
"Redirect: expected empty, got %v"
,
redirect
)
}
if
ar
:=
g
.
AllowRecording
();
ar
{
t
.
Errorf
(
"Allow Recording: expected false, got %v"
,
ar
)
}
api
,
err
:=
g
.
API
()
if
err
!=
nil
||
api
==
nil
{
t
.
Errorf
(
"Couldn't get API: %v"
,
err
)
...
...
rtpconn/webclient.go
View file @
019f3659
...
...
@@ -822,7 +822,7 @@ func getGroupStatus(g *group.Group) map[string]interface{} {
status
[
"locked"
]
=
message
}
}
if
dn
:=
g
.
D
isplayName
()
;
dn
!=
""
{
if
dn
:=
g
.
D
escription
()
.
DisplayName
;
dn
!=
""
{
status
[
"displayName"
]
=
dn
}
return
status
...
...
@@ -1265,7 +1265,7 @@ func setPermissions(g *group.Group, id string, perm string) error {
switch
perm
{
case
"op"
:
c
.
permissions
.
Op
=
true
if
g
.
AllowRecording
()
{
if
g
.
Description
()
.
AllowRecording
{
c
.
permissions
.
Record
=
true
}
case
"unop"
:
...
...
@@ -1360,7 +1360,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
Value
:
s
,
})
}
if
redirect
:=
g
.
Redirect
()
;
redirect
!=
""
{
if
redirect
:=
g
.
Description
()
.
Redirect
;
redirect
!=
""
{
// We normally redirect at the HTTP level, but the group
// description could have been edited in the meantime.
return
c
.
write
(
clientMessage
{
...
...
webserver/webserver.go
View file @
019f3659
...
...
@@ -305,7 +305,7 @@ func groupHandler(w http.ResponseWriter, r *http.Request) {
return
}
if
redirect
:=
g
.
Redirect
()
;
redirect
!=
""
{
if
redirect
:=
g
.
Description
()
.
Redirect
;
redirect
!=
""
{
http
.
Redirect
(
w
,
r
,
redirect
,
http
.
StatusPermanentRedirect
)
return
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment