(t *testing.T)
| 88 | } |
| 89 | |
| 90 | func (r *Room) insertCreateEvents(t *testing.T) { |
| 91 | t.Helper() |
| 92 | var joinRule gomatrixserverlib.JoinRuleContent |
| 93 | var hisVis gomatrixserverlib.HistoryVisibilityContent |
| 94 | plContent := eventutil.InitialPowerLevelsContent(r.creator.ID) |
| 95 | switch r.preset { |
| 96 | case PresetTrustedPrivateChat: |
| 97 | fallthrough |
| 98 | case PresetPrivateChat: |
| 99 | joinRule.JoinRule = "invite" |
| 100 | hisVis.HistoryVisibility = "shared" |
| 101 | case PresetPublicChat: |
| 102 | joinRule.JoinRule = "public" |
| 103 | hisVis.HistoryVisibility = "shared" |
| 104 | } |
| 105 | |
| 106 | r.CreateAndInsert(t, r.creator, gomatrixserverlib.MRoomCreate, map[string]interface{}{ |
| 107 | "creator": r.creator.ID, |
| 108 | "room_version": r.Version, |
| 109 | }, WithStateKey("")) |
| 110 | r.CreateAndInsert(t, r.creator, gomatrixserverlib.MRoomMember, map[string]interface{}{ |
| 111 | "membership": "join", |
| 112 | }, WithStateKey(r.creator.ID)) |
| 113 | r.CreateAndInsert(t, r.creator, gomatrixserverlib.MRoomPowerLevels, plContent, WithStateKey("")) |
| 114 | r.CreateAndInsert(t, r.creator, gomatrixserverlib.MRoomJoinRules, joinRule, WithStateKey("")) |
| 115 | r.CreateAndInsert(t, r.creator, gomatrixserverlib.MRoomHistoryVisibility, hisVis, WithStateKey("")) |
| 116 | } |
| 117 | |
| 118 | // Create an event in this room but do not insert it. Does not modify the room in any way (depth, fwd extremities, etc) so is thread-safe. |
| 119 | func (r *Room) CreateEvent(t *testing.T, creator *User, eventType string, content interface{}, mods ...eventModifier) *gomatrixserverlib.HeaderedEvent { |
no test coverage detected