Skip to content

Commit

Permalink
Merge pull request ppy#10907 from notbakaneko/fix-nominated-button-un…
Browse files Browse the repository at this point in the history
…resolved-issue-count

Fix nomination button disabled state with unresolved issues and discussion post editing
  • Loading branch information
nanaya authored Jan 30, 2024
2 parents 96356e7 + e8c1cc0 commit 7be19a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions resources/js/beatmap-discussions/discussion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class Discussion extends React.Component<Props> {
}

@computed
private get resolvedSystemPostId() {
private get resolvedStateChangedPostId() {
// TODO: handling resolved status in bundles....?
if (this.props.discussionsState == null) return -1;

Expand Down Expand Up @@ -236,7 +236,7 @@ export class Discussion extends React.Component<Props> {
post={post}
read={this.isRead(post)}
readonly={this.readonly}
resolved={post.id > this.resolvedSystemPostId}
resolvedStateChangedPostId={this.resolvedStateChangedPostId}
store={this.props.store}
type={type}
user={user}
Expand Down
4 changes: 2 additions & 2 deletions resources/js/beatmap-discussions/discussions-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ export default class DiscussionsState {
return this.nonDeletedDiscussions
.reduce((sum, discussion) => {
if (discussion.can_be_resolved && !discussion.resolved) {
if (discussion.beatmap_id == null) return sum++;
if (discussion.beatmap_id == null) return sum + 1;

const beatmap = this.store.beatmaps.get(discussion.beatmap_id);
if (beatmap != null && beatmap.deleted_at == null) return sum++;
if (beatmap != null && beatmap.deleted_at == null) return sum + 1;
}

return sum;
Expand Down
6 changes: 3 additions & 3 deletions resources/js/beatmap-discussions/post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface Props {
post: BeatmapsetDiscussionMessagePostJson;
read: boolean;
readonly: boolean;
resolved: boolean;
resolvedStateChangedPostId: number;
store: BeatmapsetDiscussionsStore;
type: string;
user: UserJson;
Expand All @@ -50,7 +50,7 @@ interface Props {
@observer
export default class Post extends React.Component<Props> {
static defaultProps = {
resolved: false,
resolvedStateChangedPostId: -1,
};

@observable private canSave = true; // this isn't computed because Editor's onChange doesn't provide anything to react to.
Expand Down Expand Up @@ -85,7 +85,7 @@ export default class Post extends React.Component<Props> {
return this.isAdmin
|| (!downloadLimited(this.beatmapset)
&& this.isOwn
&& !this.props.resolved
&& this.props.post.id > this.props.resolvedStateChangedPostId
&& !this.beatmapset.discussion_locked
);
}
Expand Down

0 comments on commit 7be19a0

Please sign in to comment.