-
Notifications
You must be signed in to change notification settings - Fork 731
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
Fixes ended poll voting #5473
Merged
Merged
Fixes ended poll voting #5473
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e4ce4ab
Adds server side vote blocking for ended polls
ericdecanini 080844d
Removes event timestamp condition for sdk poll voting
ericdecanini 628a160
Reverts timestamp condition but changes timing of setting closedTime
ericdecanini df6ae4b
Fixes warning for debugging
ericdecanini fe3c9cc
Reverts to fix by removing event timestamp condition
ericdecanini 6db1c37
Reverts to fix by removing event timestamp condition
ericdecanini 6a59007
Reverts debug isPollActive
ericdecanini 610c67c
Refactors buildPollItem in MessageItemFactory
ericdecanini f24d8c2
Merge remote-tracking branch 'origin/develop' into bugfix/eric/voting…
ericdecanini 86765c9
Adds new line at the end of PollState
ericdecanini 06e0047
Fixes import ordering in DefaultNavigator
ericdecanini 9806f1b
Merge remote-tracking branch 'origin/develop' into bugfix/eric/voting…
ericdecanini 98b7d19
Adds getBestX following merge from develop
ericdecanini a2d18d4
Fixes PollMode import error in TimelineFragment
ericdecanini a46901a
Makes PollState a sealed interface
ericdecanini 9c8f29e
Merge branch 'develop' into bugfix/eric/voting-ended-poll
ericdecanini d11fc06
Fixes crash due to empty constructor in CreatePollViewState
ericdecanini fbb6f11
Fixes remote echo of end poll not processing correctly
ericdecanini 7449d15
Merge remote-tracking branch 'origin/develop' into bugfix/eric/voting…
ericdecanini edfe81c
Merge remote-tracking branch 'origin/develop' into bugfix/eric/voting…
ericdecanini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fixes polls being votable after being ended |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
780 changes: 415 additions & 365 deletions
780
.../main/java/im/vector/app/features/home/room/detail/timeline/factory/MessageItemFactory.kt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
vector/src/main/java/im/vector/app/features/poll/PollState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2022 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package im.vector.app.features.poll | ||
|
||
sealed interface PollState { | ||
object Sending : PollState | ||
object Ready : PollState | ||
data class Voted(val votes: Int) : PollState | ||
object Undisclosed : PollState | ||
object Ended : PollState | ||
|
||
fun isVotable() = this !is Sending && this !is Ended | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source of the bug is here. A local echo being processed before the remote echo meant that the remote echo never reaches past this point.
closedTime
thus never gets set from the remote and always turns out to be the current time millis of the local device that ended the poll. If the device has time that's out of sync with unix current time, this bug can occurcc @onurays
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for the clarification.