mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-07 06:03:09 -06:00
Use newly added GMSL HistoryVisibility
This commit is contained in:
parent
888297f831
commit
075618833f
|
|
@ -162,7 +162,7 @@ func getStateForEvents(ctx context.Context, db storage.Database, events []*gomat
|
|||
return nil, fmt.Errorf("initial event does not exist: %w", err)
|
||||
}
|
||||
// By default if no history_visibility is set, or if the value is not understood, the visibility is assumed to be shared
|
||||
var hisVis = "shared"
|
||||
var hisVis = gomatrixserverlib.HistoryVisibilityShared
|
||||
historyEvent, _, err := db.SelectTopologicalEvent(ctx, int(pos.Depth), "m.room.history_visibility", ev.RoomID())
|
||||
if err != nil {
|
||||
if err != sql.ErrNoRows {
|
||||
|
|
@ -172,7 +172,7 @@ func getStateForEvents(ctx context.Context, db storage.Database, events []*gomat
|
|||
} else {
|
||||
hisVis, err = historyEvent.HistoryVisibility()
|
||||
if err != nil {
|
||||
hisVis = "shared"
|
||||
hisVis = gomatrixserverlib.HistoryVisibilityShared
|
||||
}
|
||||
}
|
||||
// get the membership event
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ func testHistoryVisibility(t *testing.T, dbType test.DBType) {
|
|||
// check guest and normal user accounts
|
||||
for _, accType := range []userapi.AccountType{userapi.AccountTypeGuest, userapi.AccountTypeUser} {
|
||||
testCases := []struct {
|
||||
historyVisibility string
|
||||
historyVisibility gomatrixserverlib.HistoryVisibility
|
||||
wantResult result
|
||||
}{
|
||||
{
|
||||
|
|
@ -380,14 +380,6 @@ func testHistoryVisibility(t *testing.T, dbType test.DBType) {
|
|||
seeAfterInvite: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
historyVisibility: "default",
|
||||
wantResult: result{
|
||||
seeWithoutJoin: false,
|
||||
seeBeforeJoin: true,
|
||||
seeAfterInvite: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
bobDev.AccountType = accType
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ type Room struct {
|
|||
ID string
|
||||
Version gomatrixserverlib.RoomVersion
|
||||
preset Preset
|
||||
visibility string
|
||||
visibility gomatrixserverlib.HistoryVisibility
|
||||
creator *User
|
||||
|
||||
authEvents gomatrixserverlib.AuthEvents
|
||||
|
|
@ -98,10 +98,10 @@ func (r *Room) insertCreateEvents(t *testing.T) {
|
|||
fallthrough
|
||||
case PresetPrivateChat:
|
||||
joinRule.JoinRule = "invite"
|
||||
hisVis.HistoryVisibility = "shared"
|
||||
hisVis.HistoryVisibility = gomatrixserverlib.HistoryVisibilityShared
|
||||
case PresetPublicChat:
|
||||
joinRule.JoinRule = "public"
|
||||
hisVis.HistoryVisibility = "shared"
|
||||
hisVis.HistoryVisibility = gomatrixserverlib.HistoryVisibilityShared
|
||||
}
|
||||
|
||||
if r.visibility != "" {
|
||||
|
|
@ -247,7 +247,7 @@ func RoomPreset(p Preset) roomModifier {
|
|||
}
|
||||
}
|
||||
|
||||
func RoomHistoryVisibility(vis string) roomModifier {
|
||||
func RoomHistoryVisibility(vis gomatrixserverlib.HistoryVisibility) roomModifier {
|
||||
return func(t *testing.T, r *Room) {
|
||||
r.visibility = vis
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue