mirror of
https://github.com/wassname/talk.git
synced 2026-08-05 13:30:26 +08:00
feat: support deleting comment reactions
This commit is contained in:
@@ -315,6 +315,27 @@ export function encodeActionCounts(...actions: Action[]): EncodedActionCounts {
|
||||
return actionCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* invertEncodedActionCounts will allow inverting of the action count object.
|
||||
*
|
||||
* @param actionCounts the encoded action counts to invert
|
||||
*/
|
||||
export function invertEncodedActionCounts(
|
||||
actionCounts: EncodedActionCounts
|
||||
): EncodedActionCounts {
|
||||
for (const key in actionCounts) {
|
||||
if (!actionCounts.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (actionCounts[key] > 0) {
|
||||
actionCounts[key] = -actionCounts[key];
|
||||
}
|
||||
}
|
||||
|
||||
return actionCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* encodeActionCountKeys encodes the action into string keys which represents
|
||||
* the groupings as seen in `EncodedActionCounts`.
|
||||
|
||||
Reference in New Issue
Block a user