Skip to content

Commit

Permalink
Don't set customTag with property name value. (#2645)
Browse files Browse the repository at this point in the history
  • Loading branch information
sufyanAbbasi authored Aug 13, 2024
1 parent 473427f commit cde332e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import com.google.android.ground.model.geometry.LinearRing
import com.google.android.ground.model.geometry.MultiPolygon
import com.google.android.ground.model.geometry.Point
import com.google.android.ground.model.geometry.Polygon
import com.google.android.ground.model.locationofinterest.LOI_NAME_PROPERTY
import com.google.android.ground.model.locationofinterest.LoiProperties
import com.google.android.ground.model.mutation.LocationOfInterestMutation
import com.google.android.ground.model.mutation.Mutation
Expand Down Expand Up @@ -103,7 +102,7 @@ fun LocationOfInterestMutation.createLoiMessage(user: User) = locationOfInterest
jobId = me.jobId
submissionCount = me.submissionCount
ownerId = me.userId
customTag = me.customId.ifEmpty { me.properties[LOI_NAME_PROPERTY]?.toString() ?: "" }
customTag = me.customId

properties.putAll(me.properties.toMessageMap())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ class LoiMutationConverterTest {
}

@Test
fun `toMap() customTag falls back to name property when empty`() {
fun `toMap() customTag is empty when empty`() {
// NOTE(#2626): Was previously erroneously set to the property name.
val mutation =
LocationOfInterestMutation(
userId = TEST_USER.id,
Expand All @@ -140,7 +141,7 @@ class LoiMutationConverterTest {
)

val map = mutation.createLoiMessage(TEST_USER).toFirestoreMap()
assertThat(map[CUSTOM_TAG_FIELD_NUMBER.toString()]).isEqualTo(LOCATION_OF_INTEREST_NAME)
assertThat(map[CUSTOM_TAG_FIELD_NUMBER.toString()]).isNull()
}

@Test
Expand Down

0 comments on commit cde332e

Please sign in to comment.