Skip to content

FIX: proper handling of group memberships#3

Open
akshayutture-augment wants to merge 1 commit into
group-dm-user-addition-prefrom
group-dm-user-addition-post
Open

FIX: proper handling of group memberships#3
akshayutture-augment wants to merge 1 commit into
group-dm-user-addition-prefrom
group-dm-user-addition-post

Conversation

@akshayutture-augment

@akshayutture-augment akshayutture-augment commented Nov 17, 2025

Copy link
Copy Markdown

No description provided.

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 4 suggestions posted.

Comment augment review to trigger a new review at any time.

<a {{bind-attr class=":next showingLast:disabled"}} {{action "next"}}>{{fa-icon "fast-forward"}}</a>
</div>
<div class="ac-wrap clearfix">
{{each member in members itemView="group-member"}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the Handlebars each helper with itemView won’t instantiate your group-member view; this likely results in members not rendering (and the member variable in the item template not resolving). This will break the admin members list display.

🤖 Was this useful? React with 👍 or 👎


totalPages: function() {
if (this.get("user_count") == 0) { return 0; }
return Math.floor(this.get("user_count") / this.get("limit")) + 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totalPages uses Math.floor(...)+1, which overcounts when user_count is an exact multiple of limit, showing an extra page. This leads to an empty page at the end of pagination.

🤖 Was this useful? React with 👍 or 👎

if (this.get("showingLast")) { return; }

var group = this.get("model"),
offset = Math.min(group.get("offset") + group.get("limit"), group.get("user_count"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In next(), the computed offset can equal user_count, which yields an empty result set and advances to a blank page. This makes the last pagination step show no members.

🤖 Was this useful? React with 👍 or 👎


render_serialized(members.to_a, GroupUserSerializer)
limit = (params[:limit] || 50).to_i
offset = params[:offset].to_i

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

offset = params[:offset].to_i is not sanitized; a negative value can produce an invalid SQL OFFSET and a 500 if a crafted request supplies a negative offset. This server-side edge case bypasses the client’s clamping.

🤖 Was this useful? React with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants