Skip to content

Commit

Permalink
Exposing new fields on GraphQL API for shared feeds invitations
Browse files Browse the repository at this point in the history
- Adding feed_teams connection to Feed and Team
- Adding feed_team (get by database ID) to the root query type
- Allow feed owner to delete a FeedTeam

Reference: CV2-3900.
  • Loading branch information
caiosba authored Oct 27, 2023
1 parent 4231d04 commit da03192
Show file tree
Hide file tree
Showing 7 changed files with 344 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/graph/types/feed_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions app/graph/types/query_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions app/graph/types/team_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def shared_teams
field :saved_searches, SavedSearchType.connection_type, null: true
field :project_groups, ProjectGroupType.connection_type, null: true
field :feeds, FeedType.connection_type, null: true
field :feed_teams, FeedTeamType.connection_type, null: false
field :tipline_newsletters, TiplineNewsletterType.connection_type, null: true
field :tipline_resources, TiplineResourceType.connection_type, null: true

Expand Down
3 changes: 3 additions & 0 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
68 changes: 68 additions & 0 deletions lib/relay.idl
Original file line number Diff line number Diff line change
Expand Up @@ -8430,6 +8430,27 @@ type Feed implements Node {
"""
last: Int
): FeedInvitationConnection!
feed_teams(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String

"""
Returns the elements in the list that come before the specified cursor.
"""
before: String

"""
Returns the first _n_ elements from the list.
"""
first: Int

"""
Returns the last _n_ elements from the list.
"""
last: Int
): FeedTeamConnection!
filters: JsonStringType
id: ID!
licenses: [Int]
Expand Down Expand Up @@ -8611,6 +8632,27 @@ type FeedTeam implements Node {
updated_at: String
}

"""
The connection type for FeedTeam.
"""
type FeedTeamConnection {
"""
A list of edges.
"""
edges: [FeedTeamEdge]

"""
A list of nodes.
"""
nodes: [FeedTeam]

"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
totalCount: Int
}

"""
An edge in a connection.
"""
Expand Down Expand Up @@ -11690,6 +11732,11 @@ type Query {
"""
feed_invitation(id: ID!): FeedInvitation

"""
Information about the feed_team with given id
"""
feed_team(id: ID!): FeedTeam

"""
Find whether a team exists
"""
Expand Down Expand Up @@ -12875,6 +12922,27 @@ type Team implements Node {
description: String
dynamic_search_fields_json_schema: JsonStringType
feed(dbid: Int!): Feed
feed_teams(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String

"""
Returns the elements in the list that come before the specified cursor.
"""
before: String

"""
Returns the first _n_ elements from the list.
"""
first: Int

"""
Returns the last _n_ elements from the list.
"""
last: Int
): FeedTeamConnection!
feeds(
"""
Returns the elements in the list that come after the specified cursor.
Expand Down
240 changes: 240 additions & 0 deletions public/relay.json
Original file line number Diff line number Diff line change
Expand Up @@ -45752,6 +45752,71 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "feed_teams",
"description": null,
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "FeedTeamConnection",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "filters",
"description": null,
Expand Down Expand Up @@ -46944,6 +47009,87 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "FeedTeamConnection",
"description": "The connection type for FeedTeam.",
"fields": [
{
"name": "edges",
"description": "A list of edges.",
"args": [

],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "FeedTeamEdge",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "nodes",
"description": "A list of nodes.",
"args": [

],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "FeedTeam",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "pageInfo",
"description": "Information to aid in pagination.",
"args": [

],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "PageInfo",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "totalCount",
"description": null,
"args": [

],
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [

],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "FeedTeamEdge",
Expand Down Expand Up @@ -61529,6 +61675,35 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "feed_team",
"description": "Information about the feed_team with given id",
"args": [
{
"name": "id",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"type": {
"kind": "OBJECT",
"name": "FeedTeam",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "find_public_team",
"description": "Find whether a team exists",
Expand Down Expand Up @@ -67337,6 +67512,71 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "feed_teams",
"description": null,
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "FeedTeamConnection",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "feeds",
"description": null,
Expand Down
Loading

0 comments on commit da03192

Please sign in to comment.