Skip to content

armgit / ente

Public Imported from GitHub
0

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

Include fileID when reacting to file-scoped comments

Anand Baburajanaae8c1e0a44c
diff --git a/web/packages/gallery/components/viewer/CommentsSidebar.tsx b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
index aa338949fe..5e64dc2ec0 100644
--- a/web/packages/gallery/components/viewer/CommentsSidebar.tsx
+++ b/web/packages/gallery/components/viewer/CommentsSidebar.tsx
@@ -1145,6 +1145,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
"green_heart",
collectionKey,
identity,
+ pendingCommentLike.fileID,
);
const newReaction: UnifiedReaction = {
id: reactionID,
@@ -1339,6 +1340,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
"green_heart",
collectionKey,
storedIdentity,
+ targetComment.fileID,
);
const newReaction: UnifiedReaction = {
id: reactionID,
@@ -1398,6 +1400,7 @@ export const CommentsSidebar: React.FC<CommentsSidebarProps> = ({
targetComment.id,
"green_heart",
collection.key,
+ targetComment.fileID,
);
const newReaction: UnifiedReaction = {
id: reactionID,
diff --git a/web/packages/new/albums/services/public-reaction.ts b/web/packages/new/albums/services/public-reaction.ts
index 479da64cfb..4d7b38bf0a 100644
--- a/web/packages/new/albums/services/public-reaction.ts
+++ b/web/packages/new/albums/services/public-reaction.ts
@@ -195,6 +195,7 @@ export const addPublicReaction = async (
* @param reactionType The type of reaction (e.g., "green_heart").
* @param collectionKey The decrypted collection key (base64 encoded).
* @param anonIdentity Optional anonymous identity. If not provided, will use stored identity.
+ * @param fileID Optional file ID, required for file-scoped comments.
* @returns The ID of the created reaction.
*/
export const addPublicCommentReaction = async (
@@ -204,6 +205,7 @@ export const addPublicCommentReaction = async (
reactionType: string,
collectionKey: string,
anonIdentity?: AnonIdentity,
+ fileID?: number,
): Promise<string> => {
const identity = anonIdentity ?? getStoredAnonIdentity(collectionID);
if (!identity) {
@@ -223,6 +225,7 @@ export const addPublicCommentReaction = async (
},
body: JSON.stringify({
commentID,
+ fileID,
cipher,
nonce,
anonUserID: identity.anonUserID,
diff --git a/web/packages/new/photos/services/reaction.ts b/web/packages/new/photos/services/reaction.ts
index 0ba64e7f3e..980458afeb 100644
--- a/web/packages/new/photos/services/reaction.ts
+++ b/web/packages/new/photos/services/reaction.ts
@@ -57,6 +57,7 @@ export const addReaction = async (
* @param commentID The ID of the comment to react to.
* @param reactionType The type of reaction (e.g., "green_heart").
* @param collectionKey The decrypted collection key (base64 encoded).
+ * @param fileID Optional file ID, required for file-scoped comments.
* @returns The ID of the created reaction.
*/
export const addCommentReaction = async (
@@ -64,6 +65,7 @@ export const addCommentReaction = async (
commentID: string,
reactionType: string,
collectionKey: string,
+ fileID?: number,
): Promise<string> => {
const { encryptedData: cipher, nonce } = await encryptBox(
new TextEncoder().encode(padReaction(reactionType)),
@@ -76,7 +78,7 @@ export const addCommentReaction = async (
...(await authenticatedRequestHeaders()),
"Content-Type": "application/json",
},
- body: JSON.stringify({ collectionID, commentID, cipher, nonce }),
+ body: JSON.stringify({ collectionID, commentID, fileID, cipher, nonce }),
});
ensureOk(res);
const { id } = UpsertReactionResponse.parse(await res.json());