Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Notify for all replies in shared albums

ashilkne3492251d004
diff --git a/mobile/apps/photos/lib/db/social_db.dart b/mobile/apps/photos/lib/db/social_db.dart
index bb62fedbf3..ec2ea9c7c6 100644
--- a/mobile/apps/photos/lib/db/social_db.dart
+++ b/mobile/apps/photos/lib/db/social_db.dart
@@ -509,8 +509,8 @@ class SocialDB {
/// Gets all replies to comments, excluding the current user's own replies.
/// Returns replies sorted by created_at DESC.
- Future<List<Comment>> getRepliesToUserComments({
- required int targetUserID,
+ Future<List<Comment>> getReplies({
+ required int excludeUserID,
int limit = 100,
int offset = 0,
}) async {
@@ -520,7 +520,7 @@ class SocialDB {
_commentsTable,
where:
'parent_comment_id IS NOT NULL AND is_deleted = 0 AND user_id != ?',
- whereArgs: [targetUserID],
+ whereArgs: [excludeUserID],
orderBy: 'created_at DESC',
limit: limit,
offset: offset,
@@ -611,8 +611,8 @@ class SocialDB {
/// Gets all replies after [sinceTime], excluding the current user.
/// Returns replies sorted by created_at DESC.
- Future<List<Comment>> getRepliesToUserCommentsSince({
- required int targetUserID,
+ Future<List<Comment>> getRepliesSince({
+ required int excludeUserID,
required int sinceTime,
}) async {
final db = await database;
@@ -620,7 +620,7 @@ class SocialDB {
_commentsTable,
where: 'parent_comment_id IS NOT NULL AND is_deleted = 0 '
'AND user_id != ? AND created_at > ?',
- whereArgs: [targetUserID, sinceTime],
+ whereArgs: [excludeUserID, sinceTime],
orderBy: 'created_at DESC',
);
return rows.map(_rowToComment).toList();
diff --git a/mobile/apps/photos/lib/models/social/feed_data_provider.dart b/mobile/apps/photos/lib/models/social/feed_data_provider.dart
index b05da720f8..593538c063 100644
--- a/mobile/apps/photos/lib/models/social/feed_data_provider.dart
+++ b/mobile/apps/photos/lib/models/social/feed_data_provider.dart
@@ -40,7 +40,7 @@ class FeedDataProvider {
final results = await Future.wait([
_db.getReactionsOnFiles(excludeUserID: userID, limit: limit),
_db.getCommentsOnFiles(excludeUserID: userID, limit: limit),
- _db.getRepliesToUserComments(targetUserID: userID, limit: limit),
+ _db.getReplies(excludeUserID: userID, limit: limit),
_db.getReactionsOnUserComments(targetUserID: userID, limit: limit),
_db.getReactionsOnUserReplies(targetUserID: userID, limit: limit),
]);
diff --git a/mobile/apps/photos/lib/services/social_notification_coordinator.dart b/mobile/apps/photos/lib/services/social_notification_coordinator.dart
index 74af0d27e7..4d8f59b732 100644
--- a/mobile/apps/photos/lib/services/social_notification_coordinator.dart
+++ b/mobile/apps/photos/lib/services/social_notification_coordinator.dart
@@ -157,8 +157,8 @@ class SocialNotificationCoordinator {
);
}
- final List<Comment> replies = await db.getRepliesToUserCommentsSince(
- targetUserID: userID,
+ final List<Comment> replies = await db.getRepliesSince(
+ excludeUserID: userID,
sinceTime: cutoffTime,
);
final List<Reaction> photoLikes = await db.getReactionsOnFilesSince(
@@ -166,28 +166,21 @@ class SocialNotificationCoordinator {
sinceTime: cutoffTime,
);
- final repliesNeedingOwnerCheck = <Comment>[];
- final fileIDsNeedingOwnership = <int>{};
-
for (final reply in replies) {
- if (reply.parentCommentUserID == userID) {
- considerCandidate(
- _SocialActivityCandidate(
- type: FeedItemType.reply,
- collectionID: reply.collectionID,
- fileID: reply.fileID,
- commentID: reply.id,
- createdAt: reply.createdAt,
- actorUserID: reply.userID,
- actorAnonID: reply.anonUserID,
- ),
- );
- } else if (reply.fileID != null) {
- repliesNeedingOwnerCheck.add(reply);
- fileIDsNeedingOwnership.add(reply.fileID!);
- }
+ considerCandidate(
+ _SocialActivityCandidate(
+ type: FeedItemType.reply,
+ collectionID: reply.collectionID,
+ fileID: reply.fileID,
+ commentID: reply.id,
+ createdAt: reply.createdAt,
+ actorUserID: reply.userID,
+ actorAnonID: reply.anonUserID,
+ ),
+ );
}
+ final fileIDsNeedingOwnership = <int>{};
for (final reaction in photoLikes) {
if (reaction.fileID != null) {
fileIDsNeedingOwnership.add(reaction.fileID!);
@@ -221,23 +214,6 @@ class SocialNotificationCoordinator {
);
}
- for (final reply in repliesNeedingOwnerCheck) {
- if (!isOwnedByUser(reply.fileID)) {
- continue;
- }
- considerCandidate(
- _SocialActivityCandidate(
- type: FeedItemType.reply,
- collectionID: reply.collectionID,
- fileID: reply.fileID,
- commentID: reply.id,
- createdAt: reply.createdAt,
- actorUserID: reply.userID,
- actorAnonID: reply.anonUserID,
- ),
- );
- }
-
if (latestByKey.isEmpty) {
return;
}