Limit to 10 pinned answers

This commit is contained in:
Karina Kwiatek 2023-02-07 23:14:33 +01:00
parent de73532bef
commit fa68ab27d7
2 changed files with 2 additions and 1 deletions

View File

@ -7,6 +7,7 @@ class UserController < ApplicationController
def show
@answers = @user.cursored_answers(last_id: params[:last_id])
@pinned_answers = @user.answers.pinned.limit(10)
@answers_last_id = @answers.map(&:id).min
@more_data_available = !@user.cursored_answers(last_id: @answers_last_id, size: 1).count.zero?

View File

@ -1,6 +1,6 @@
- unless @user.banned?
#pinned-answers
- @user.answers.pinned.each do |a|
- @pinned_answers.each do |a|
= render "answerbox", a:
#answers