[github] Unread markers not showing because isReadByViewer is always true (IDEA-346776)

#IDEA-346776 Fixed

In testing, I was focused on making persistent  state logic work well.
Sadly that meant I disabled `isReadByViewer` in code during testing and never noticed
that it's always `true`. Now we found out in testing that this is the case.

GitOrigin-RevId: 98ba6cca676e8da6f5b1ed0dcf1de90f03646de7
This commit is contained in:
Chris Lemaire
2024-02-20 15:08:34 +01:00
committed by intellij-monorepo-bot
parent dc60755350
commit f9039bbafd
3 changed files with 2 additions and 5 deletions

View File

@@ -39,7 +39,7 @@ class GHPullRequest(id: String,
val headRefOid: String,
val headRepository: GHRepository?,
override val reactions: GHReactable.ReactionConnection)
: GHPullRequestShort(id, url, number, title, state, isDraft, author, createdAt, updatedAt, isReadByViewer,
: GHPullRequestShort(id, url, number, title, state, isDraft, author, createdAt, updatedAt,
assignees, labels, reviewRequests, reviewThreads,
reviews, mergeable, viewerCanUpdate, viewerCanReact, viewerDidAuthor, reactions) {

View File

@@ -20,7 +20,6 @@ open class GHPullRequestShort(id: String,
val author: GHActor?,
val createdAt: Date,
val updatedAt: Date,
val isReadByViewer: Boolean,
@JsonProperty("assignees") assignees: GraphQLNodesDTO<GHUser>,
@JsonProperty("labels") labels: GraphQLNodesDTO<GHLabel>,
@JsonProperty("reviewRequests") reviewRequests: GraphQLNodesDTO<GHPullRequestReviewRequest>,
@@ -66,7 +65,6 @@ open class GHPullRequestShort(id: String,
if (author != other.author) return false
if (createdAt != other.createdAt) return false
if (updatedAt != other.updatedAt) return false
if (isReadByViewer != other.isReadByViewer) return false
if (mergeable != other.mergeable) return false
if (viewerCanUpdate != other.viewerCanUpdate) return false
if (viewerDidAuthor != other.viewerDidAuthor) return false
@@ -90,7 +88,6 @@ open class GHPullRequestShort(id: String,
result = 31 * result + (author?.hashCode() ?: 0)
result = 31 * result + createdAt.hashCode()
result = 31 * result + updatedAt.hashCode()
result = 31 * result + isReadByViewer.hashCode()
result = 31 * result + mergeable.hashCode()
result = 31 * result + viewerCanUpdate.hashCode()
result = 31 * result + viewerDidAuthor.hashCode()

View File

@@ -27,7 +27,7 @@ class GHPRPersistentInteractionState : SerializablePersistentStateComponent<GHPR
fun isSeen(pr: GHPullRequestShort): Boolean {
val lastSeen = state.prStates.find { it.id == pr.prId }?.lastSeen
val isSeen = (lastSeen != null && Date(lastSeen) >= pr.updatedAt) || pr.isReadByViewer
val isSeen = (lastSeen != null && Date(lastSeen) >= pr.updatedAt)
// TODO: Revise this check when adding a new-in-timeline line.
// Cleanup state entries for PRs that have updates