Skip to content

Commit

Permalink
fix for contributors page (#3500)
Browse files Browse the repository at this point in the history
* fix for contributors page

* Update tag_controller.rb
  • Loading branch information
jywarren authored Sep 26, 2018
1 parent d44f1d7 commit 35449fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/controllers/tag_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def show
@answered_questions = []
@questions&.each { |question| @answered_questions << question if question.answers.any?(&:accepted) }
@wikis = nodes if @node_type == 'wiki'
@wikis ||= []
@nodes = nodes if @node_type == 'maps'
@title = params[:id]
# the following could be refactored into a Tag.contributor_count method:
Expand Down Expand Up @@ -198,9 +199,7 @@ def show_for_author
.where(status: 1, type: node_type)
.paginate(page: params[:page], per_page: 24)

# breaks the parameter
# sets everything to an empty array
set_sidebar :tags, [params[:id]]
@notes ||= []

@notes = nodes.where('node.nid NOT IN (?)', qids) if @node_type == 'note'
@questions = nodes.where('node.nid IN (?)', qids) if @node_type == 'questions'
Expand Down
13 changes: 13 additions & 0 deletions test/functional/tag_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ def setup
assert_equal [['myfourthtag', Tag.find_by_name('myfourthtag').tid], ['myfifthtag', Tag.find_by_name('myfifthtag').tid]], JSON.parse(response.body)['saved']
end

test 'check extra tag page' do
UserSession.create(users(:bob))

get :show,
params: {
node_type: 'contributors',
id: 'blog'
}

assert_template :show
assert_response :success
end

test 'validate unused tag' do
UserSession.create(users(:bob))

Expand Down

0 comments on commit 35449fd

Please sign in to comment.