Skip to content

Commit b1b41e6

Browse files
authored
Merge pull request #1035 from indentlabs/fix-content-classifying
Fix content scoping regressions
2 parents 4908a4a + 761d909 commit b1b41e6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/controllers/application_controller.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,24 @@ def cache_linkable_content_for_each_content_type
180180
# so all we need to grab is additional pages in contributable universes
181181
@linkables_raw[page_type] = @current_user_content[page_type]
182182

183-
if !@universe_scope && @contributable_universe_ids.any?
183+
# Add contributor content
184+
if @contributable_universe_ids.any?
184185
existing_page_ids = @linkables_raw[page_type].map(&:id)
185186

186187
pages_to_add = if page_type == Universe.name
187188
page_type.constantize.where(id: @contributable_universe_ids)
188189
.where.not(id: existing_page_ids)
190+
.where.not(user_id: current_user.id)
189191
else
190192
page_type.constantize.where(universe_id: @contributable_universe_ids)
191193
.where.not(id: existing_page_ids)
194+
.where.not(user_id: current_user.id)
195+
end
196+
197+
# If we're scoped to a universe, also scope contributor content pulled to that
198+
# universe. If we're not, leave it as all contributor content.
199+
if @universe_scope && pages_to_add.klass.respond_to?(:universe)
200+
pages_to_add = pages_to_add.where(universe: @universe_scope)
192201
end
193202

194203
filtered_fields = ContentPage.polymorphic_content_fields.map(&:to_s)

0 commit comments

Comments
 (0)