0.2.82
This commit is contained in:
@@ -24,6 +24,7 @@ type requestIdentity struct {
|
||||
component string
|
||||
userID string
|
||||
user string
|
||||
viewer string
|
||||
device string
|
||||
client string
|
||||
protocol string
|
||||
@@ -73,6 +74,21 @@ func identify(ctx context.Context, sess store.Session) {
|
||||
}
|
||||
}
|
||||
|
||||
// identifyViewer names the person watching, where that is somebody other than the account
|
||||
// itself. A main viewer is deliberately not recorded: its name is already the "user" field,
|
||||
// and printing it twice on every line would say nothing.
|
||||
func identifyViewer(ctx context.Context, viewer store.Viewer) {
|
||||
identity := identityFrom(ctx)
|
||||
if identity == nil || viewer.IsMain() {
|
||||
return
|
||||
}
|
||||
if viewer.Name != "" {
|
||||
identity.viewer = viewer.Name
|
||||
} else {
|
||||
identity.viewer = viewer.ID
|
||||
}
|
||||
}
|
||||
|
||||
func (i *requestIdentity) attrs() []any {
|
||||
if i == nil {
|
||||
return nil
|
||||
@@ -124,6 +140,9 @@ func (i *requestIdentity) viewerAttrs() []any {
|
||||
if i.user != "" {
|
||||
attrs = append(attrs, "user", i.user)
|
||||
}
|
||||
if i.viewer != "" {
|
||||
attrs = append(attrs, "viewer", i.viewer)
|
||||
}
|
||||
if i.device != "" {
|
||||
attrs = append(attrs, "device", i.device)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user