aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-04-23 00:04:10 +0300
committerTulir Asokan <tulir@maunium.net>2018-04-23 00:04:10 +0300
commitea965766b4cac0fc9e4df7babe2347cfcf850b9b (patch)
tree3d7a567ead256deef1991407ba84ad9bb52948e4
parentfafc7f55be8c206d52de72522645091dd7a73b03 (diff)
Gofmt and enable a test
-rw-r--r--matrix/rooms/room.go2
-rw-r--r--matrix/rooms/room_test.go19
-rw-r--r--ui/room-view.go2
-rw-r--r--ui/view-main.go2
4 files changed, 11 insertions, 14 deletions
diff --git a/matrix/rooms/room.go b/matrix/rooms/room.go
index c10a2fd..99c9a66 100644
--- a/matrix/rooms/room.go
+++ b/matrix/rooms/room.go
@@ -27,7 +27,7 @@ import (
type RoomNameSource int
const (
- ExplicitRoomName RoomNameSource = iota
+ ExplicitRoomName RoomNameSource = iota
CanonicalAliasRoomName
AliasRoomName
MemberRoomName
diff --git a/matrix/rooms/room_test.go b/matrix/rooms/room_test.go
index 2f3f402..40624e1 100644
--- a/matrix/rooms/room_test.go
+++ b/matrix/rooms/room_test.go
@@ -26,7 +26,6 @@ import (
)
func TestNewRoom_DefaultValues(t *testing.T) {
- /*
room := rooms.NewRoom("!test:maunium.net", "@tulir:maunium.net")
assert.Equal(t, "!test:maunium.net", room.ID)
assert.Equal(t, "@tulir:maunium.net", room.SessionUserID)
@@ -36,7 +35,6 @@ func TestNewRoom_DefaultValues(t *testing.T) {
assert.Empty(t, room.GetCanonicalAlias())
assert.Empty(t, room.GetTopic())
assert.Nil(t, room.GetSessionOwner())
- */
}
func TestRoom_GetCanonicalAlias(t *testing.T) {
@@ -61,7 +59,6 @@ func TestRoom_GetTopic(t *testing.T) {
assert.Equal(t, "test topic", room.GetTopic())
}
-
func TestRoom_GetAliases(t *testing.T) {
room := rooms.NewRoom("!test:maunium.net", "@tulir:maunium.net")
addAliases(room)
@@ -94,7 +91,7 @@ func addCanonicalAlias(room *rooms.Room) {
func addAliases(room *rooms.Room) {
server1 := "maunium.net"
room.UpdateState(&gomatrix.Event{
- Type: "m.room.aliases",
+ Type: "m.room.aliases",
StateKey: &server1,
Content: map[string]interface{}{
"aliases": []interface{}{"#bar:maunium.net", "#test:maunium.net", "#foo:maunium.net"},
@@ -103,7 +100,7 @@ func addAliases(room *rooms.Room) {
server2 := "matrix.org"
room.UpdateState(&gomatrix.Event{
- Type: "m.room.aliases",
+ Type: "m.room.aliases",
StateKey: &server2,
Content: map[string]interface{}{
"aliases": []interface{}{"#foo:matrix.org", "#test:matrix.org"},
@@ -114,11 +111,11 @@ func addAliases(room *rooms.Room) {
func addMembers(room *rooms.Room, count int) {
user1 := "@tulir:maunium.net"
room.UpdateState(&gomatrix.Event{
- Type: "m.room.member",
+ Type: "m.room.member",
StateKey: &user1,
Content: map[string]interface{}{
"displayname": "tulir",
- "membership": "join",
+ "membership": "join",
},
})
@@ -127,16 +124,16 @@ func addMembers(room *rooms.Room, count int) {
content := map[string]interface{}{
"membership": "join",
}
- if i % 2 == 1 {
+ if i%2 == 1 {
content["displayname"] = fmt.Sprintf("User #%d", i+1)
}
- if i % 5 == 0 {
+ if i%5 == 0 {
content["membership"] = "invite"
}
room.UpdateState(&gomatrix.Event{
- Type: "m.room.member",
+ Type: "m.room.member",
StateKey: &userN,
- Content: content,
+ Content: content,
})
}
}
diff --git a/ui/room-view.go b/ui/room-view.go
index 4cf7320..5f9a8de 100644
--- a/ui/room-view.go
+++ b/ui/room-view.go
@@ -163,7 +163,7 @@ func (view *RoomView) GetStatus() string {
var buf strings.Builder
if len(view.completions.list) > 0 {
- if view.completions.textCache != view.input.GetText() || view.completions.time.Add(10 * time.Second).Before(time.Now()) {
+ if view.completions.textCache != view.input.GetText() || view.completions.time.Add(10*time.Second).Before(time.Now()) {
view.completions.list = []string{}
} else {
buf.WriteString(strings.Join(view.completions.list, ", "))
diff --git a/ui/view-main.go b/ui/view-main.go
index ba98719..c693fcd 100644
--- a/ui/view-main.go
+++ b/ui/view-main.go
@@ -240,7 +240,7 @@ func (view *MainView) MouseEventHandler(roomView *RoomView, event *tcell.EventMo
}
} else if isInArea(x, y, view.roomList) && event.Buttons() == tcell.Button1 {
_, rly, _, _ := msgView.GetRect()
- n := y-rly+1
+ n := y - rly + 1
if n >= 0 && n < len(view.roomIDs) {
view.SwitchRoom(n)
}