Commit ee8d2b95 authored by Eugene Shapovalov's avatar Eugene Shapovalov 💬

Fix crash with assignees in MergeRequest.

parent 4214db40
......@@ -15,7 +15,8 @@ data class Issue(
@SerializedName("author") val author: ShortUser,
@SerializedName("milestone") val milestone: Milestone?,
@SerializedName("project_id") val projectId: Long,
@SerializedName("assignees") val assignees: List<ShortUser>,
// Assignees can be null in MergeRequest, so assume it can be null too.
@SerializedName("assignees") val assignees: List<ShortUser>?,
@SerializedName("updated_at") val updatedAt: ZonedDateTime?,
@SerializedName("title") val title: String?,
@SerializedName("created_at") val createdAt: ZonedDateTime,
......@@ -35,5 +36,6 @@ data class Issue(
@SerializedName("merge_requests_count") val relatedMergeRequestCount: Int,
@SerializedName("time_stats") val timeStats: TimeStats,
@SerializedName("weight") val weight: Int?,
@SerializedName("discussion_locked") val discussionLocked: Boolean
@SerializedName("discussion_locked") val discussionLocked: Boolean,
@SerializedName("assignee") val assignee: ShortUser?
)
\ No newline at end of file
......@@ -42,7 +42,8 @@ data class MergeRequest(
@SerializedName("merged_by") val mergedBy: ShortUser?,
@SerializedName("merged_at") val mergedAt: ZonedDateTime?,
@SerializedName("changes") val changes: List<MergeRequestChange>?,
@SerializedName("assignees") val assignees: List<ShortUser>,
// It sometimes can be null.
@SerializedName("assignees") val assignees: List<ShortUser>?,
@SerializedName("time_stats") val timeStats: TimeStats,
@SerializedName("discussion_locked") val discussionLocked: Boolean
)
......@@ -53,7 +53,6 @@ abstract class Target {
val title get() = _title!!
val state get() = _state!!
val labels get() = _labels!!
val assignees get() = _assignees!!
val userNotesCount get() = _userNotesCount!!
val upVotes get() = _upVotes!!
val downVotes get() = _downVotes!!
......
......@@ -34,7 +34,7 @@ class IssueInfoFragment : BaseFragment(), IssueInfoView {
override fun showInfo(issue: Issue) {
with(issue) {
showAssignees(assignees)
showAssignees(assignees ?: assignee?.let { listOf(it) } ?: emptyList())
showMilestone(milestone)
showDueDate(dueDate)
showTimeStats(timeStats)
......
......@@ -35,7 +35,7 @@ class MergeRequestInfoFragment : BaseFragment(), MergeRequestInfoView {
override fun showInfo(mr: MergeRequest) {
with(mr) {
showAssignees(assignees)
showAssignees(assignees ?: assignee?.let { listOf(it) } ?: emptyList())
showMilestone(milestone)
showMergeStatus(state, mergeStatus)
showTimeStats(timeStats)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment