mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 12:27:16 +08:00
FIX: group activity's mentions infinite loading (#27070)
In 07ecbb5a3b
we ensure the mentions in a group's activity page worked properly but we missed adding proper support for infinite loading.
The client is using the `before` parameter instead of the `before_post_id` to do the pagination.
This adds support for `before` as well as some tests to ensure it doesn't regress.
I also added tests to the group's activity posts as well since those were missing.
Finally I deleted some unused code (`group.messages_for`) which is not used anymore.
Context - https://meta.discourse.org/t/-/308044/9
This commit is contained in:
@ -229,7 +229,10 @@ class GroupsController < ApplicationController
|
||||
guardian.ensure_can_see_group_members!(group)
|
||||
|
||||
posts =
|
||||
group.mentioned_posts_for(guardian, params.permit(:before_post_id, :category_id)).limit(20)
|
||||
group.mentioned_posts_for(
|
||||
guardian,
|
||||
params.permit(:before_post_id, :before, :category_id),
|
||||
).limit(20)
|
||||
|
||||
response = { posts: serialize_data(posts, GroupPostSerializer) }
|
||||
|
||||
@ -249,7 +252,10 @@ class GroupsController < ApplicationController
|
||||
guardian.ensure_can_see_group_members!(group)
|
||||
|
||||
@posts =
|
||||
group.mentioned_posts_for(guardian, params.permit(:before_post_id, :category_id)).limit(50)
|
||||
group.mentioned_posts_for(
|
||||
guardian,
|
||||
params.permit(:before_post_id, :before, :category_id),
|
||||
).limit(50)
|
||||
@title =
|
||||
"#{SiteSetting.title} - #{I18n.t("rss_description.group_mentions", group_name: group.name)}"
|
||||
@link = Discourse.base_url
|
||||
|
Reference in New Issue
Block a user