-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
123 changed files
with
6,402 additions
and
2,051 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module FeedInvitationMutations | ||
MUTATION_TARGET = 'feed_invitation'.freeze | ||
PARENTS = ['feed'].freeze | ||
|
||
class Create < Mutations::CreateMutation | ||
argument :email, GraphQL::Types::String, required: true | ||
argument :feed_id, GraphQL::Types::Int, required: true, camelize: false | ||
end | ||
|
||
class Destroy < Mutations::DestroyMutation; end | ||
|
||
class Accept < Mutations::UpdateMutation | ||
argument :id, GraphQL::Types::Int, required: true | ||
argument :team_id, GraphQL::Types::Int, required: true, camelize: false | ||
|
||
field :success, GraphQL::Types::Boolean, null: true | ||
|
||
def resolve(id:, team_id:) | ||
success = false | ||
feed_invitation = FeedInvitation.find_if_can(id, context[:ability]) | ||
if User.current && Team.current && User.current.team_ids.include?(team_id) && feed_invitation.email == User.current.email | ||
feed_invitation.accept!(team_id) | ||
success = true | ||
end | ||
{ success: success } | ||
end | ||
end | ||
|
||
class Reject < Mutations::BaseMutation | ||
argument :id, GraphQL::Types::Int, required: true | ||
|
||
field :success, GraphQL::Types::Boolean, null: true | ||
|
||
def resolve(id:) | ||
success = false | ||
feed_invitation = FeedInvitation.find_if_can(id, context[:ability]) | ||
if User.current && Team.current && feed_invitation.email == User.current.email && feed_invitation.state == 'invited' | ||
feed_invitation.reject! | ||
success = true | ||
end | ||
{ success: success } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
class TiplineMessagesPagination < GraphQL::Pagination::ArrayConnection | ||
# def cursor_for(item) | ||
# encode(item.id.to_i.to_s) | ||
# end | ||
# | ||
# def load_nodes | ||
# @nodes ||= begin | ||
# sliced_nodes = if before && after | ||
# end_idx = index_from_cursor(before) | ||
# start_idx = index_from_cursor(after) | ||
# items.where(id: start_idx..end_idx) | ||
# elsif before | ||
# end_idx = index_from_cursor(before) | ||
# items.where('id < ?', end_idx) | ||
# elsif after | ||
# start_idx = index_from_cursor(after) | ||
# items.where('id > ?', start_idx) | ||
# else | ||
# items | ||
# end | ||
# | ||
# @has_previous_page = if last | ||
# # There are items preceding the ones in this result | ||
# sliced_nodes.count > last | ||
# elsif after | ||
# # We've paginated into the Array a bit, there are some behind us | ||
# index_from_cursor(after) > items.map(&:id).min | ||
# else | ||
# false | ||
# end | ||
# | ||
# @has_next_page = if first | ||
# # There are more items after these items | ||
# sliced_nodes.count > first | ||
# elsif before | ||
# # The original array is longer than the `before` index | ||
# index_from_cursor(before) < items.map(&:id).max | ||
# else | ||
# false | ||
# end | ||
# | ||
# limited_nodes = sliced_nodes | ||
# | ||
# limited_nodes = limited_nodes.first(first) if first | ||
# limited_nodes = limited_nodes.last(last) if last | ||
# | ||
# limited_nodes | ||
# end | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class FeedInvitationType < DefaultObject | ||
description "Feed invitation type" | ||
|
||
implements GraphQL::Types::Relay::Node | ||
|
||
field :dbid, GraphQL::Types::Int, null: false | ||
field :feed_id, GraphQL::Types::Int, null: false | ||
field :feed, FeedType, null: false | ||
field :user_id, GraphQL::Types::Int, null: false | ||
field :user, UserType, null: false | ||
field :state, GraphQL::Types::String, null: false | ||
field :email, GraphQL::Types::String, null: false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class TiplineRequestType < DefaultObject | ||
description "TiplineRequest type" | ||
|
||
implements GraphQL::Types::Relay::Node | ||
|
||
field :dbid, GraphQL::Types::Int, null: true | ||
field :value_json, JsonStringType, null: true | ||
field :annotation, AnnotationType, null: true | ||
field :annotation_id, GraphQL::Types::Int, null: true | ||
field :associated_graphql_id, GraphQL::Types::String, null: true | ||
field :smooch_user_slack_channel_url, GraphQL::Types::String, null: true | ||
field :smooch_user_external_identifier, GraphQL::Types::String, null: true | ||
field :smooch_report_received_at, GraphQL::Types::Int, null: true | ||
field :smooch_report_update_received_at, GraphQL::Types::Int, null: true | ||
field :smooch_user_request_language, GraphQL::Types::String, null: true | ||
field :smooch_report_sent_at, GraphQL::Types::Int, null: true | ||
field :smooch_report_correction_sent_at, GraphQL::Types::Int, null: true | ||
field :smooch_request_type, GraphQL::Types::String, null: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.