aboutsummaryrefslogtreecommitdiff
path: root/roomserver/internal/perform/perform_publish.go
blob: aab282f395b70bac30288cbb2c565a2dc3415b36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package perform

import (
	"context"

	"github.com/matrix-org/dendrite/roomserver/api"
	"github.com/matrix-org/dendrite/roomserver/storage"
)

type Publisher struct {
	DB storage.Database
}

func (r *Publisher) PerformPublish(
	ctx context.Context,
	req *api.PerformPublishRequest,
	res *api.PerformPublishResponse,
) {
	err := r.DB.PublishRoom(ctx, req.RoomID, req.Visibility == "public")
	if err != nil {
		res.Error = &api.PerformError{
			Msg: err.Error(),
		}
	}
}