diff --git a/app/graph/types/feed_type.rb b/app/graph/types/feed_type.rb index 7e5593c0e4..702faaba3b 100644 --- a/app/graph/types/feed_type.rb +++ b/app/graph/types/feed_type.rb @@ -44,4 +44,5 @@ def requests(**args) field :feed_invitations, FeedInvitationType.connection_type, null: false field :teams, TeamType.connection_type, null: false + field :feed_teams, FeedTeamType.connection_type, null: false end diff --git a/app/graph/types/query_type.rb b/app/graph/types/query_type.rb index a340647923..52d20a3f4a 100644 --- a/app/graph/types/query_type.rb +++ b/app/graph/types/query_type.rb @@ -215,6 +215,7 @@ def dynamic_annotation_field(query:, only_cache: nil) feed request feed_invitation + feed_team tipline_message ].each do |type| field type, diff --git a/app/models/ability.rb b/app/models/ability.rb index 84f21cd749..f0526a34a2 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -85,6 +85,9 @@ def editor_perms end can [:create, :update, :read, :destroy], [Account, Source, TiplineNewsletter, TiplineResource, Feed, FeedTeam], :team_id => @context_team.id can [:create, :update, :destroy], FeedInvitation, { feed: { team_id: @context_team.id } } + can :destroy, FeedTeam do |obj| + obj.team.id == @context_team.id || obj.feed.team.id == @context_team.id + end can [:cud], AccountSource, source: { team: { team_users: { team_id: @context_team.id }}} %w(annotation comment dynamic task tag).each do |annotation_type| can [:cud], annotation_type.classify.constantize do |obj|