Only store our own aliases in publicroomsapi (#1081)

Otherwise we just store the latest aliases submitted from a server,
which is not what we want.
This commit is contained in:
Kegsay 2020-06-02 15:01:13 +01:00 committed by GitHub
parent 794c63e757
commit 02b150fd13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 44 additions and 31 deletions

View file

@ -19,10 +19,11 @@ import (
"net/url"
"github.com/matrix-org/dendrite/publicroomsapi/storage/sqlite3"
"github.com/matrix-org/gomatrixserverlib"
)
// NewPublicRoomsServerDatabase opens a database connection.
func NewPublicRoomsServerDatabase(dataSourceName string) (Database, error) {
func NewPublicRoomsServerDatabase(dataSourceName string, localServerName gomatrixserverlib.ServerName) (Database, error) {
uri, err := url.Parse(dataSourceName)
if err != nil {
return nil, err
@ -31,7 +32,7 @@ func NewPublicRoomsServerDatabase(dataSourceName string) (Database, error) {
case "postgres":
return nil, fmt.Errorf("Cannot use postgres implementation")
case "file":
return sqlite3.NewPublicRoomsServerDatabase(uri.Path)
return sqlite3.NewPublicRoomsServerDatabase(uri.Path, localServerName)
default:
return nil, fmt.Errorf("Cannot use postgres implementation")
}