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

Allow Arisa to work on issues that just have been resolved #144

Closed
NeunEinser opened this issue Apr 22, 2020 · 0 comments · Fixed by #149
Closed

Allow Arisa to work on issues that just have been resolved #144

NeunEinser opened this issue Apr 22, 2020 · 0 comments · Fixed by #149
Assignees
Labels
enhancement New feature or request

Comments

@NeunEinser
Copy link
Member

NeunEinser commented Apr 22, 2020

private fun searchIssues(
jql: String,
startAt: Int,
onQueryPaginated: () -> Unit
): List<Issue> {
val searchResult = jiraClient
.searchIssues(jql, "*all", "changelog", MAX_RESULTS, startAt)
if (startAt + searchResult.max < searchResult.total)
onQueryPaginated()
return searchResult
.issues
.filter(::lastActionWasNotAResolve)
}
private fun lastActionWasNotAResolve(issue: Issue): Boolean {
val latestChange = issue.changeLog.entries.lastOrNull()
return latestChange == null ||
latestChange.isNotATransition() ||
latestChange.wasDoneByTheBot() ||
latestChange.commentAfterIt(issue)
}
private fun ChangeLogEntry.commentAfterIt(issue: Issue) =
(issue.comments.isNotEmpty() && issue.comments.last().updatedDate > created)
private fun ChangeLogEntry.wasDoneByTheBot() =
author.name == config[Arisa.Credentials.username]
private fun ChangeLogEntry.isNotATransition() =
!items.any { it.field == "resolution" }
}

The filter (filter(::lastActionWasNotAResolve)) before the return statement of searchIssues currently prevents all modules from seeing issues that were resolved or reopened as the last action.

However, for most modules this is not required, and modules like the AttachmentModule should always see all issues.
Furthermore it prevents modules like requested in #145, #116, #50 and #38 to be implemented in any meaningful way.

I propose that this filter is removed from the module executor, and modules that do require it, should implement their own assertions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant