14 Commits

Author SHA1 Message Date
Kabiru Mwenja 98ce241beb Restructure emoji reactions queries to be independent of the Reactable assoc mixin
Atm, `Journal` is the only reactable model, so emoji reaction queries were naively performed on the "Journal" static interface. However, should we introduce another Reactable, then this approach falls apart quickly as the methods would be duplicated and practically accessible from any of the Reactables.

Therefore, we extract emoji reactions "grouping" queries into their own encapsulation that makes it agnostic to the reactable- it further adds convenience method parameters allowing either an "reactable:" kw arg or "reactable_type:" and "reactable_id:" pair.

https://community.openproject.org/wp/64167

Follows #18988
2025-05-27 14:06:39 +03:00
Kabiru Mwenja 1a66f36577 Use work_package.add_journal method to avoid validity clashes 2025-05-21 17:47:20 +03:00
Kabiru Mwenja 079d8033ff Add unit tests for Reactable.grouped_work_package_journals_emoji_reactions 2025-05-21 17:24:51 +03:00
Kabiru Mwenja 4b874d8494 Use consistent naming for Journal emoji reactions convenience method 2025-05-21 17:02:40 +03:00
Kabiru Mwenja c93e0ec577 Use internal comment scope when quering emoji reactions 2025-05-21 17:00:40 +03:00
Jan Sandbrink 0b87e7543f Freeze string literals in specs
Rolling out frozen string literals further by freezing all
string literals in core specs.
2025-05-05 09:29:55 +02:00
Alexander Brandon Coles 7a5124522c Fix typo in user_format: s/coma/comma/ 2025-02-14 07:27:08 -03:00
Kabiru Mwenja 80cea6e41e chore[Op#40437]: improve var naming; make less generic 2024-10-25 15:08:15 +03:00
Kabiru Mwenja 232df803f5 fix[Op#40437]: remove support for emoji reactions timeslicing
Emoji Reactions should always be returned in their current state, timeslicing will yield incorrect results.
At any given time, we ONLY need to know what reactions a Journal has. Further, EmojiReactions are never updated, rather created
and destroyed.

Retain timeslicing only for the journal render- where that is relevant to find updated journals
2024-10-25 11:55:22 +03:00
Kabiru Mwenja e6aed59bbe fix[Op#40437]: ensure emojis and user reactions are ordered in asc order 2024-10-25 11:48:20 +03:00
Kabiru Mwenja 30b831faa8 chore[Op#40437]: ensure emoji reactions returns empty hash when no reactions 2024-10-25 10:55:08 +03:00
Kabiru Mwenja 65c2aa2a21 chore[Op#40437]: add timestamp spec 2024-10-24 18:19:52 +03:00
Kabiru Mwenja 29f0155d98 feat[Op#40437]: define emoji reactions aggregation in index component
Pass it down the component chain. TODO: reduce allocation bloat by extracting it to a lazy memoized helper
2024-10-24 13:52:06 +03:00
Kabiru Mwenja 9f08b83e7c feat[Op#40437]: Introduce single emoji reactions aggregation query to avoid n+1 calls on journals 2024-10-23 20:12:47 +03:00