common

package
v0.0.0-...-46fd052 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimezone = "Europe/Paris"

DefaultTimezone is used when no timezone is specified, as this parameter is required.

Variables

View Source
var DoCommonHTTP = doCommonSettingsRequest

DoCommonHTTP is the indirection used to perform HTTP calls to the common settings API. Tests can override this variable to stub network calls.

View Source
var ErrCommonSettingsVersionMismatch = errors.New("common settings version mismatch")

ErrCommonSettingsVersionMismatch indicates that the remote common settings version differs from the local instance version and the update should not proceed.

View Source
var GetRemoteCommonSettings = getRemoteCommonSettings

Functions

func CreateCommonSettings

func CreateCommonSettings(inst *instance.Instance, settings *couchdb.JSONDoc) error

CreateCommonSettings creates user settings for an instance via the common settings API. The common settings version is increased on the instance, but it's the caller's responsibility to persist it.

func IsMatrixID

func IsMatrixID(id string) bool

IsMatrixID reports whether id has the `@localpart:server` shape. A stored value that fails the check is ignored in favour of the derived one.

func UpdateAvatar

func UpdateAvatar(inst *instance.Instance) (bool, error)

UpdateAvatar updates user settings for an instance via the common settings API when the avatar has been updated. The common settings version is increased on the instance, but it's the caller's responsibility to persist it when the bool returned is true (aka a common settings call has been made).

func UpdateCommonSettings

func UpdateCommonSettings(inst *instance.Instance, settings *couchdb.JSONDoc) (bool, error)

UpdateCommonSettings updates user settings for an instance via the common settings API. The common settings version is increased on the instance, but it's the caller's responsibility to persist it when the bool returned is true (aka a common settings call has been made).

Types

type UserSettingsPayload

type UserSettingsPayload struct {
	Language    string `json:"language,omitempty"`
	Timezone    string `json:"timezone,omitempty"`
	LastName    string `json:"last_name,omitempty"`
	FirstName   string `json:"first_name,omitempty"`
	Email       string `json:"email,omitempty"`
	Phone       string `json:"phone,omitempty"`
	MatrixID    string `json:"matrix_id,omitempty"`
	DisplayName string `json:"display_name,omitempty"`
	Avatar      string `json:"avatar,omitempty"`
}

UserSettingsPayload represents the payload structure for user settings

type UserSettingsRequest

type UserSettingsRequest struct {
	Source    string              `json:"source"`
	Nickname  string              `json:"nickname"`
	RequestID string              `json:"request_id"`
	Timestamp int64               `json:"timestamp"`
	Version   int                 `json:"version"`
	Payload   UserSettingsPayload `json:"payload"`
}

UserSettingsRequest represents the complete request structure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL