Skip to content

Commit

Permalink
chore: updates with PostOperationValidationRule fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarenaldi committed Feb 3, 2025
1 parent 581d459 commit 00363c9
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 16 deletions.
113 changes: 109 additions & 4 deletions packages/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,24 @@ type AuthenticationTokens {
idToken: IdToken!
}

input BanAccountGroupRuleConfig {
enable: AlwaysTrue
}

input BanGroupAccountRequest {
"""The group you want to ban member on."""
group: EvmAddress!

"""The account you want to ban on the group."""
account: EvmAddress!
}

type BanGroupAccountResponse {
hash: TxHash!
}

union BanGroupAccountResult = BanGroupAccountResponse | SponsoredTransactionRequest | SelfFundedTransactionRequest | TransactionWillFail

scalar BigDecimal

type BigDecimalKeyValue {
Expand Down Expand Up @@ -2702,9 +2720,50 @@ type Group {
metadata: GroupMetadata
owner: EvmAddress!
operations: LoggedInGroupOperations

"""Returns true if the group has banning rule enabled"""
banningEnabled: Boolean!

"""Returns true if the group has membership approval rule enabled"""
membershipApprovalEnabled: Boolean!
rules: GroupRules!
}

type GroupBannedAccount {
ruleId: RuleId!
account: Account!
bannedBy: Account!
lastActiveAt: DateTime!
bannedAt: DateTime!
}

input GroupBannedAccountsFilter {
"""The optional filter to narrow banned accounts by search query."""
searchBy: UsernameSearchInput
}

enum GroupBannedAccountsOrderBy {
LAST_BANNED
FIRST_BANNED
LAST_ACTIVE
ACCOUNT_SCORE
}

input GroupBannedAccountsRequest {
"""The group"""
group: EvmAddress!
filter: GroupBannedAccountsFilter

"""The order by."""
orderBy: GroupBannedAccountsOrderBy! = ACCOUNT_SCORE

"""The page size."""
pageSize: PageSize! = FIFTY

"""The cursor."""
cursor: Cursor
}

input GroupGatedFeedRuleConfig {
group: EvmAddress!
}
Expand Down Expand Up @@ -2843,6 +2902,7 @@ type GroupRule {

input GroupRuleConfig {
membershipApprovalRule: MembershipApprovalGroupRuleConfig
banAccountRule: BanAccountGroupRuleConfig
tokenGatedRule: TokenGatedGroupRuleConfig
simplePaymentRule: SimplePaymentGroupRuleConfig
unknownRule: UnknownGroupRuleConfig
Expand All @@ -2859,7 +2919,7 @@ enum GroupRuleType {
TOKEN_GATED
SIMPLE_PAYMENT
MEMBERSHIP_APPROVAL
BAN_MEMBER
BAN_ACCOUNT
UNKNOWN
}

Expand All @@ -2868,6 +2928,7 @@ enum GroupRuleUnsatisfiedReason {
TOKEN_GATED_ACCOUNT_REMOVAL_STILL_TOKEN_HOLDER
SIMPLE_PAYMENT_NOT_ENOUGH_BALANCE
MEMBERSHIP_APPROVAL_REQUIRED
ACCOUNT_BANNED
}

type GroupRules {
Expand Down Expand Up @@ -3187,6 +3248,7 @@ type LoggedInGroupOperations {
canAddMember: GroupOperationValidationOutcome!
canRemoveMember: GroupOperationValidationOutcome!
isMember: Boolean!
isBanned: Boolean!
}

type LoggedInPostOperations {
Expand Down Expand Up @@ -4304,6 +4366,22 @@ type Mutation {
You MUST be a group owner or admin to use this mutation
"""
rejectGroupMembershipRequest(request: RejectGroupMembershipRequest!): RejectGroupMembershipResult!

"""
Ban account to join a group
Banned account MUST not be a member of a group.
Use `removeGroupMember` mutation with `ban` flag to remove and ban existing members
You MUST be authenticated as Account Owner or Account Manager to use this mutation.
"""
banGroupAccount(request: BanGroupAccountRequest!): BanGroupAccountResult!

"""
Unban account
You MUST be authenticated as Account Owner or Account Manager to use this mutation.
"""
unbanGroupAccount(request: UnbanGroupAccountRequest!): UnbanGroupAccountResult!
createSnsSubscriptions(request: CreateSnsSubscriptionRequest!): [SnsSubscription!]!
deleteSnsSubscription(request: DeleteSnsSubscriptionRequest!): Void!

Expand Down Expand Up @@ -4564,8 +4642,6 @@ input OnboardingUserChallengeRequest {
wallet: EvmAddress!
}

union OperationValidationRule = PostRule | FeedRule

enum PageSize {
TEN
FIFTY
Expand Down Expand Up @@ -4654,6 +4730,11 @@ type PaginatedGraphsResult {
pageInfo: PaginatedResultInfo!
}

type PaginatedGroupBannedAccountsResult {
items: [GroupBannedAccount!]!
pageInfo: PaginatedResultInfo!
}

type PaginatedGroupMembersResult {
items: [GroupMember!]!
pageInfo: PaginatedResultInfo!
Expand Down Expand Up @@ -4924,8 +5005,10 @@ type PostOperationValidationPassed {
passed: AlwaysTrue!
}

union PostOperationValidationRule = PostRule | FeedRule

type PostOperationValidationUnknown {
extraChecksRequired: [OperationValidationRule!]!
extraChecksRequired: [PostOperationValidationRule!]!
}

type PostReaction {
Expand Down Expand Up @@ -5327,6 +5410,9 @@ type Query {
"""Get the group membership requests"""
groupMembershipRequests(request: GroupMembershipRequestsRequest!): PaginatedGroupMembershipRequestsResult!

"""Get the banned accounts of a group"""
groupBannedAccounts(request: GroupBannedAccountsRequest!): PaginatedGroupBannedAccountsResult!

"""Get admins for a graph/app/sponsor/feed/username/group address"""
adminsFor(request: AdminsForRequest!): PaginatedAdminsResult!

Expand Down Expand Up @@ -5494,6 +5580,9 @@ input RemoveGroupMemberRequest {
"""The account you want to remove from the group."""
account: EvmAddress!

"""Ban the account from the joining the group."""
ban: Boolean! = false

"""The processing params for the join rules."""
rulesProcessingParams: [GroupRulesProcessingParams!]
}
Expand Down Expand Up @@ -6458,6 +6547,8 @@ enum TransactionOperation {
GROUP_MEMBERSHIP_APPROVAL_REQUEST_CANCELLED
GROUP_MEMBERSHIP_APPROVAL_APPROVED
GROUP_MEMBERSHIP_APPROVAL_REJECTED
GROUP_ACCOUNT_BANNED
GROUP_ACCOUNT_UNBANNED
NAMESPACE_FACTORY_DEPLOYMENT
SPONSOR_FREE_PAYMASTER_CREATED
SPONSOR_ADDED_TO_APPROVED_SIGNERS
Expand Down Expand Up @@ -6552,6 +6643,20 @@ type UnassignUsernameResponse {

union UnassignUsernameToAccountResult = UnassignUsernameResponse | SponsoredTransactionRequest | SelfFundedTransactionRequest | TransactionWillFail

input UnbanGroupAccountRequest {
"""The group you want to unban member on."""
group: EvmAddress!

"""The account you want to unban on the group."""
account: EvmAddress!
}

type UnbanGroupAccountResponse {
hash: TxHash!
}

union UnbanGroupAccountResult = UnbanGroupAccountResponse | SponsoredTransactionRequest | SelfFundedTransactionRequest | TransactionWillFail

type UnblockError {
error: UnblockErrorType!
}
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/src/fragments/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const PostRuleFragment = graphql(
export type PostRule = FragmentOf<typeof PostRuleFragment>;

export const PostOperationValidationRuleFragment = graphql(
`fragment PostOperationValidationRule on OperationValidationRule {
`fragment PostOperationValidationRule on PostOperationValidationRule {
... on PostRule {
...PostRule
}
Expand Down
Loading

0 comments on commit 00363c9

Please sign in to comment.