mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
161420fac0
Collapse user actions in UI so it stops looking crazy Removed dud dupe user action TOPIC_RESPONSE Always show the owner of a post on the user page, actions by others at the bottom
16 lines
692 B
CoffeeScript
16 lines
692 B
CoffeeScript
describe "Discourse.UserAction", ->
|
|
|
|
describe "collapseStream", ->
|
|
it "collapses all likes", ->
|
|
actions = [
|
|
Discourse.UserAction.create(action_type: Discourse.UserAction.LIKE, topic_id:1, user_id:1, post_number:1)
|
|
Discourse.UserAction.create(action_type: Discourse.UserAction.EDIT, topic_id:2, user_id:1, post_number:1)
|
|
Discourse.UserAction.create(action_type: Discourse.UserAction.LIKE, topic_id:1, user_id:2, post_number:1)
|
|
]
|
|
|
|
actions = Discourse.UserAction.collapseStream(actions)
|
|
expect(actions.length).toBe(2)
|
|
|
|
expect(actions[0].get("children").length).toBe(1)
|
|
expect(actions[0].get("children")[0].items.length).toBe(2)
|
|
|