UX: Fix confusing "claim reviewable" positioning (#28870)

Previously for reviewables that could be claimed, we positioned
the "you can claim / you must claim" message and button underneath
the "Is there something wrong with this post?" message but _before_
the reviewable action buttons like Yes/No/Ignore. This was a confusing
flow.

This commit fixes the issue, and also makes it so if claiming is
required and the reviewable has not been claimed, we don't show
the "Is there something wrong with this post?" which was showing
with no buttons.
This commit is contained in:
Martin Brennan 2024-09-12 16:44:12 +10:00 committed by GitHub
parent 5df402f153
commit d9af873f0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 52 additions and 24 deletions

View File

@ -70,25 +70,7 @@
{{/if}}
<div class="reviewable-actions">
{{#if this.reviewable.last_performing_username}}
<div class="stale-help">{{html-safe
(i18n
"review.stale_help"
username=this.reviewable.last_performing_username
)
}}</div>
{{else}}
{{#if this.claimEnabled}}
<div class="claimed-actions">
<span class="help">{{html-safe this.claimHelp}}</span>
<ReviewableClaimedTopic
@topicId={{this.topicId}}
@claimedBy={{this.reviewable.claimed_by}}
@onClaim={{fn (mut this.reviewable.claimed_by)}}
/>
</div>
{{/if}}
{{#unless this.reviewable.last_performing_username}}
{{#if this.canPerform}}
{{#if this.editing}}
<DButton
@ -125,7 +107,28 @@
{{/if}}
{{/if}}
{{/if}}
{{/unless}}
{{#if this.reviewable.last_performing_username}}
<div class="stale-help">{{html-safe
(i18n
"review.stale_help"
username=this.reviewable.last_performing_username
)
}}</div>
{{else}}
{{#if this.claimEnabled}}
<div class="claimed-actions">
<span class="help">{{html-safe this.claimHelp}}</span>
<ReviewableClaimedTopic
@topicId={{this.topicId}}
@claimedBy={{this.reviewable.claimed_by}}
@onClaim={{fn (mut this.reviewable.claimed_by)}}
/>
</div>
{{/if}}
{{/if}}
<PluginOutlet
@name="reviewable-item-actions"
@connectorTagName="div"

View File

@ -75,9 +75,25 @@ export default class ReviewableItem extends Component {
return classes;
}
@discourseComputed("reviewable.created_from_flag", "reviewable.status")
displayContextQuestion(createdFromFlag, status) {
return createdFromFlag && status === 0;
@discourseComputed(
"reviewable.created_from_flag",
"reviewable.status",
"claimOptional",
"claimRequired",
"reviewable.claimed_by"
)
displayContextQuestion(
createdFromFlag,
status,
claimOptional,
claimRequired,
claimedBy
) {
return (
createdFromFlag &&
status === 0 &&
(claimOptional || (claimRequired && claimedBy !== null))
);
}
@discourseComputed(
@ -94,6 +110,16 @@ export default class ReviewableItem extends Component {
return claimMode !== "disabled" && !!topicId;
}
@discourseComputed("siteSettings.reviewable_claiming", "claimEnabled")
claimOptional(claimMode, claimEnabled) {
return !claimEnabled || claimMode === "optional";
}
@discourseComputed("siteSettings.reviewable_claiming", "claimEnabled")
claimRequired(claimMode, claimEnabled) {
return claimEnabled && claimMode === "required";
}
@discourseComputed(
"claimEnabled",
"siteSettings.reviewable_claiming",

View File

@ -141,11 +141,10 @@
}
}
.reviewable-actions .claimed-actions {
.claimed-actions {
display: flex;
flex: 1 1 100%;
margin-right: 0;
justify-content: space-between;
align-items: center;
margin-bottom: 0.5em;
}