Skip to content

Commit

Permalink
fix role filtering on contributors browse table
Browse files Browse the repository at this point in the history
  • Loading branch information
acoffman committed Sep 18, 2024
1 parent 32d4868 commit 67e5621
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 0 additions & 5 deletions server/app/graphql/types/browse_tables/browse_user_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module Types::BrowseTables
class BrowseUserType < Types::Entities::UserType
connection_type_class(Types::Connections::BrowseTableConnection)

@@role_mapping = User.roles.invert
@@area_mapping = User.area_of_expertises.invert

field :revision_count, Int, null: false
Expand All @@ -12,10 +11,6 @@ def area_of_expertise
@@area_mapping[object.area_of_expertise]
end

def role
@@role_mapping[object.role]
end

def organizations
Loaders::AssociationLoader.for(MaterializedViews::UserBrowseTableRow, :affiliations).load(object).then do |affil|
affil.map do |a|
Expand Down
2 changes: 2 additions & 0 deletions server/app/models/materialized_views/user_browse_table_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class MaterializedViews::UserBrowseTableRow < MaterializedViews::MaterializedView
has_many :affiliations, primary_key: :id, foreign_key: :user_id
has_many :organizations, through: :affiliations

enum role: ['curator', 'editor', 'admin']
end

0 comments on commit 67e5621

Please sign in to comment.