Skip to content

FEP-044f quote controls#148

Merged
malkoG merged 3 commits into
hackers-pub:mainfrom
malkoG:codex-fep-044f-quote-controls
May 31, 2026
Merged

FEP-044f quote controls#148
malkoG merged 3 commits into
hackers-pub:mainfrom
malkoG:codex-fep-044f-quote-controls

Conversation

@malkoG
Copy link
Copy Markdown
Collaborator

@malkoG malkoG commented May 31, 2026

Summary

  • Add QuotePolicy and viewerCanQuote GraphQL fields to Android operations and map them through the repository/domain layer.
  • Add labeled, separate visibility and quote-permission controls in note compose.
  • Add quote-permission selection to article publishing.
  • Hide or reject quote actions when the server reports that the viewer cannot quote a post.
  • Add focused ViewModel tests for note and article quote-policy submission.

Validation

  • ./gradlew generateApolloSources
  • ./gradlew :app:compileDebugKotlin
  • ./gradlew :app:testDebugUnitTest --tests pub.hackers.android.ui.screens.compose.ComposeViewModelTest --tests pub.hackers.android.ui.screens.compose.ComposeArticleViewModelTest
  • ./gradlew :app:lintDebug

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8a48b59b-9778-4fcc-bd95-8fbfe45d598c

📥 Commits

Reviewing files that changed from the base of the PR and between 5cc68d9 and 0c9a81d.

📒 Files selected for processing (13)
  • app/src/main/graphql/pub/hackers/android/operations.graphql
  • app/src/main/graphql/pub/hackers/android/schema.graphqls
  • app/src/main/java/pub/hackers/android/data/repository/HackersPubRepository.kt
  • app/src/main/java/pub/hackers/android/domain/model/Models.kt
  • app/src/main/java/pub/hackers/android/ui/components/PostCard.kt
  • app/src/main/java/pub/hackers/android/ui/screens/compose/ComposeArticleScreen.kt
  • app/src/main/java/pub/hackers/android/ui/screens/compose/ComposeArticleViewModel.kt
  • app/src/main/java/pub/hackers/android/ui/screens/compose/ComposeScreen.kt
  • app/src/main/java/pub/hackers/android/ui/screens/compose/ComposeViewModel.kt
  • app/src/main/java/pub/hackers/android/ui/screens/postdetail/PostDetailScreen.kt
  • app/src/main/res/values/strings.xml
  • app/src/test/java/pub/hackers/android/ui/screens/compose/ComposeArticleViewModelTest.kt
  • app/src/test/java/pub/hackers/android/ui/screens/compose/ComposeViewModelTest.kt

📝 Walkthrough

Walkthrough

This PR adds comprehensive quote policy support to post creation and publishing. A new QuotePolicy enum (EVERYONE, FOLLOWERS, SELF) controls who can quote posts. Posts now expose viewerCanQuote and quotePolicy fields. Compose flows gain UI to select policy; post displays conditionally gate quote actions based on permissions.

Changes

Quote Policy Feature

Layer / File(s) Summary
GraphQL schema and operations contract
app/src/main/graphql/pub/hackers/android/schema.graphqls, app/src/main/graphql/pub/hackers/android/operations.graphql
QuotePolicy enum is introduced. Article, Note, Post, and Question types gain quotePolicy, viewerCanQuote, and viewerCanRevokeQuote fields. CreateNoteInput and PublishArticleDraftInput accept optional quotePolicy. Fragment queries and mutations updated to request and forward the policy.
Domain model: QuotePolicy enum and Post extension
app/src/main/java/pub/hackers/android/domain/model/Models.kt
QuotePolicy enum with EVERYONE, FOLLOWERS, SELF values. Post model gains viewerCanQuote: Boolean and quotePolicy: QuotePolicy fields with defaults.
Repository integration and GraphQL mapping
app/src/main/java/pub/hackers/android/data/repository/HackersPubRepository.kt
createNote() and publishArticleDraft() accept quotePolicy parameter (default EVERYONE). Domain-to-GraphQL enum mapping for mutations. PostFields.toPost() and SharedPostFields.toPost() populate viewerCanQuote and quotePolicy from GraphQL response with fallback handling.
Note composition UI and state management
app/src/main/java/pub/hackers/android/ui/screens/compose/ComposeViewModel.kt, app/src/main/java/pub/hackers/android/ui/screens/compose/ComposeScreen.kt
ComposeUiState tracks quotePolicy (default EVERYONE). UI adds toolbar button and dropdown menu for policy selection. effectiveQuotePolicy() enforces SELF for non-public visibility. setQuotedPost() validates post.viewerCanQuote before accepting quoted post. Helper functions render policy icons and labels.
Article publishing UI and state management
app/src/main/java/pub/hackers/android/ui/screens/compose/ComposeArticleViewModel.kt, app/src/main/java/pub/hackers/android/ui/screens/compose/ComposeArticleScreen.kt
ComposeArticleUiState tracks quotePolicy. UI dropdown allows policy selection during article publish. publishDraft() passes selected policy to repository.
Post display: quote capability gating
app/src/main/java/pub/hackers/android/ui/components/PostCard.kt, app/src/main/java/pub/hackers/android/ui/screens/postdetail/PostDetailScreen.kt
Quote actions conditionally displayed based on post.viewerCanQuote. EngagementBar and PostDetailScreen hide quote option when viewer lacks permission.
String resources and test coverage
app/src/main/res/values/strings.xml, app/src/test/java/pub/hackers/android/ui/screens/compose/ComposeArticleViewModelTest.kt, app/src/test/java/pub/hackers/android/ui/screens/compose/ComposeViewModelTest.kt
Added UI labels for quote policies and short variants. ComposeArticleViewModelTest verifies quote policy passes to repository. ComposeViewModelTest tests policy flow for public notes and clamping to SELF for followers-only visibility.

🎯 3 (Moderate) | ⏱️ ~25 minutes


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@malkoG malkoG merged commit 7c23503 into hackers-pub:main May 31, 2026
1 of 2 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant