Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom diffs #138

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Custom diffs #138

wants to merge 11 commits into from

Conversation

gagarski
Copy link
Collaborator

Trying to enhance code diff by allowing to select a base submission to compare from some reasonable choices.

image

submissionId: payload.submissionId,
filename
},
result: result.find((diff) => diff.toFile == filename)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff now is fetched only once, since diff endpoint returns a diff for the whole submission.

} else if (isType(action, capabilitiesFetch.done)) {
let diffModePreference: DiffModePreference

if (!action.payload.result.permissions.tags &&
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User cannot see tags => user cannot know which sub has "checked" tag.

{" "}
<Radio
name="repo-type"
value="mercurial"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Poshutili i hvatit =)

@@ -38,6 +38,13 @@ fun ProjectOwnerOrTeacherForFilter(vertx: Vertx, path: String = "project_id"): B
fun SubmissionOwnerOrTeacher(vertx: Vertx, path: String = "submission_id"): BridgeEventFilter =
ShouldBeSubmissionOwner(vertx, path) or AuthorityRequired(Authority.Teacher)

fun DiffFilter(vertx: Vertx): BridgeEventFilter {
val shouldBeTeacher = AuthorityRequired(Authority.Teacher)
val ownerWithCondition = ShouldBeSubmissionOwner(vertx) and ShouldNotRequestLastChecked(vertx)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, cannot see tags => cannot request a diff in "last checked" mode.

return ListResponse(
root = buildCodeTree(
innerResp.files,
diff.contents.flatMap { listOf(it.fromFile, it.toFile) }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not return diff from here anymore, handleSubmissionCodeDiff is now used everywhere.

@gagarski gagarski marked this pull request as ready for review October 12, 2022 18:32
kotoed-js/src/main/ts/profile/edit.tsx Outdated Show resolved Hide resolved
name="diff-mode"
value="PREVIOUS_CLOSED"
checked={this.props.denizen.diffModePreference == "PREVIOUS_CLOSED" ||
!this.props.permissions.tags && this.props.denizen.diffModePreference == "PREVIOUS_CHECKED" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is incorrect state but maybe it's ok to handle it in a such way

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to handle a situation which probably will never happen. If user was a teacher and chosen PREVIOUS_CHECKED and then his teacher permission is revoked, the preference might not be changed. Here we are trying to handle it.

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.

2 participants