Skip to content

Edit Polls and Allow Undisclosed Polls #5020

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

Merged
merged 11 commits into from
Jan 25, 2022
Merged

Edit Polls and Allow Undisclosed Polls #5020

merged 11 commits into from
Jan 25, 2022

Conversation

onurays
Copy link
Contributor

@onurays onurays commented Jan 21, 2022

Fixes: #5036, Fixes #5037

Figma

Screen Shot 2022-01-23 at 19 38 15

Screen Shot 2022-01-24 at 14 37 10

@github-actions
Copy link

github-actions bot commented Jan 21, 2022

Unit Test Results

  72 files  ±0    72 suites  ±0   49s ⏱️ -8s
141 tests ±0  141 ✔️ ±0  0 💤 ±0  0 ±0 
440 runs  ±0  440 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 04ffb95. ± Comparison against base commit f7aedff.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jan 21, 2022

Matrix SDK

Integration Tests Results:

  • [org.matrix.android.sdk.session]
    passed="21" failures="0" errors="0" skipped="2"
  • [org.matrix.android.sdk.account]
    passed="5" failures="0" errors="0" skipped="2"
  • [org.matrix.android.sdk.internal]
    passed="158" failures="1" errors="0" skipped="38"
  • [org.matrix.android.sdk.ordering]
    passed="16" failures="0" errors="0" skipped="0"
  • [org.matrix.android.sdk.PermalinkParserTest]
    passed="2" failures="0" errors="0" skipped="0"

* develop: (66 commits)
  toolbar management  (#4887)
  adding changelog entry
  adding back periodic flag when scheduling automatic background workers
  Fix enum class warning
  Split long lines Done by matrix-org/matrix-analytics-events#16
  Add new class in analytics plan
  Fix conditional for Delight issue automation
  Add missing import in kdoc
  Update kdoc
  Enable Delight issue automation
  Fix an error in string resource (#4997)
  Changelog
  Add some unit test for the command parser. Not all commands are covered, could add more tests later.
  data class.
  use sealed interface
  Small cleanup
  Command parser is not a static object anymore
  Add changelog
  Use Throwable.isLimitExceededError extension
  Do not automatically retry 429 with a too long delay
  ...
@onurays onurays changed the title Edit Polls Edit Polls and Allow Undisclosed Polls Jan 24, 2022
@onurays onurays requested a review from bmarty January 24, 2022 11:32
@onurays onurays marked this pull request as ready for review January 24, 2022 11:32
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Very nice work, thanks!
Just a few small remarks, but nothing blocking from me

data class PollUndisclosed(override val optionId: String,
override val optionAnswer: String,
val isSelected: Boolean
) : PollOptionViewState(optionId, optionAnswer)
Copy link
Member

Choose a reason for hiding this comment

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

Happy to see that the arch here is nice to do such addition of a new state!

@@ -51,4 +51,12 @@ sealed class PollOptionViewState(open val optionId: String,
val votePercentage: Double,
val isWinner: Boolean
) : PollOptionViewState(optionId, optionAnswer)

/**
* Represent a poll that is closed, votes will be hidden until the poll is ended.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe replace closed by undisclosed to avoid confusion between close and ended

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, done.

_viewEvents.post(CreatePollViewEvents.Success)
}
}
}

private fun sendEditedPoll(editedEventId: String, pollType: PollType, question: String, options: List<String>) {
val editedEvent = room.getTimeLineEvent(editedEventId) ?: return
room.editPoll(editedEvent, pollType, question, options)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: room.editPoll() first parameter could be an eventId: String to let the SDK user have a nicer API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But we don't have the room instance in EventEditor. Do we really want to inject session and pass the roomId and eventId?

Copy link
Member

Choose a reason for hiding this comment

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

OK, the API is similar to the other ones, you can leave it like this, sorry.

@@ -53,14 +53,8 @@

<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false"
android:key="SETTINGS_LABS_ENABLE_POLLS"
android:title="@string/labs_enable_polls" />
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment above the string resource labs_enable_polls like <!-- TODO Remove --> please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, I was thinking to ask you about this.

@bmarty
Copy link
Member

bmarty commented Jan 24, 2022

Quick smoke test, everything worked fine.

@bmarty bmarty merged commit 5bb0615 into develop Jan 25, 2022
@bmarty bmarty deleted the feature/ons/edit_polls branch January 25, 2022 12:47
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.

Support undisclosed polls Allow editing polls
2 participants