Commit e03e0c9d authored by Andrei Mihu's avatar Andrei Mihu
Browse files

User online indicator now observes offline status mode rather than strictly connected sockets.

parent c0eb65a7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr

## [Unreleased]
### Changed
- User online indicator now observes offline status mode rather than strictly connected sockets.
- Update sql-migrate library to a32ed26.
- Rework some migrations for better compatibility with different database engines.
- Update to Protobuf v1.5.2, GRPC v1.37.0, and GRPC-Gateway v2.3.0 releases.
+2 −2
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ WHERE u.id = $1`

	online := false
	if tracker != nil {
		online = tracker.StreamExists(PresenceStream{Mode: StreamModeNotifications, Subject: userID})
		online = tracker.StreamExists(PresenceStream{Mode: StreamModeStatus, Subject: userID})
	}

	return &api.Account{
@@ -204,7 +204,7 @@ WHERE u.id IN (` + strings.Join(statements, ",") + `)`

		online := false
		if tracker != nil {
			online = tracker.StreamExists(PresenceStream{Mode: StreamModeNotifications, Subject: uuid.FromStringOrNil(userID)})
			online = tracker.StreamExists(PresenceStream{Mode: StreamModeStatus, Subject: uuid.FromStringOrNil(userID)})
		}

		accounts = append(accounts, &api.Account{
+1 −1
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ FROM users, user_edge WHERE id = destination_id AND source_id = $1`
		friendID := uuid.FromStringOrNil(id)
		online := false
		if tracker != nil {
			online = tracker.StreamExists(PresenceStream{Mode: StreamModeNotifications, Subject: friendID})
			online = tracker.StreamExists(PresenceStream{Mode: StreamModeStatus, Subject: friendID})
		}

		user := &api.User{
+1 −1
Original line number Diff line number Diff line
@@ -1450,7 +1450,7 @@ WHERE u.id = ge.destination_id AND ge.source_id = $1`
			EdgeCount:             int32(edgeCount),
			CreateTime:            &timestamp.Timestamp{Seconds: createTime.Time.Unix()},
			UpdateTime:            &timestamp.Timestamp{Seconds: updateTime.Time.Unix()},
			Online:                tracker.StreamExists(PresenceStream{Mode: StreamModeNotifications, Subject: userID}),
			Online:                tracker.StreamExists(PresenceStream{Mode: StreamModeStatus, Subject: userID}),
		}

		groupUser := &api.GroupUserList_GroupUser{
+1 −1
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ func convertUser(tracker Tracker, rows *sql.Rows) (*api.User, error) {
		EdgeCount:             int32(edgeCount),
		CreateTime:            &timestamp.Timestamp{Seconds: createTime.Time.Unix()},
		UpdateTime:            &timestamp.Timestamp{Seconds: updateTime.Time.Unix()},
		Online:                tracker.StreamExists(PresenceStream{Mode: StreamModeNotifications, Subject: userID}),
		Online:                tracker.StreamExists(PresenceStream{Mode: StreamModeStatus, Subject: userID}),
	}, nil
}