-
Notifications
You must be signed in to change notification settings - Fork 442
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
feat: introduce PollManager #14038
base: main
Are you sure you want to change the base?
feat: introduce PollManager #14038
Conversation
Signed-off-by: Maksim Sukharev <[email protected]>
Signed-off-by: Maksim Sukharev <[email protected]>
Signed-off-by: Maksim Sukharev <[email protected]>
Signed-off-by: Maksim Sukharev <[email protected]>
f95083c
to
7f7cfea
Compare
canCreatePollDrafts() { | ||
return hasTalkFeature(this.token, 'talk-polls-drafts') && this.$store.getters.isModerator | ||
&& [CONVERSATION.TYPE.GROUP, CONVERSATION.TYPE.PUBLIC].includes(this.conversation.type) | ||
}, |
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.
canCreatePollDrafts() { | |
return hasTalkFeature(this.token, 'talk-polls-drafts') && this.$store.getters.isModerator | |
&& [CONVERSATION.TYPE.GROUP, CONVERSATION.TYPE.PUBLIC].includes(this.conversation.type) | |
}, | |
canCreatePollDrafts() { | |
return hasTalkFeature(this.token, 'talk-polls-drafts') | |
}, |
Redundancy as LobbySettings
is wrapped with those conditions
@@ -182,6 +197,11 @@ export default { | |||
getRelativeTime() { | |||
return futureRelativeTime(this.lobbyTimer) | |||
}, | |||
|
|||
canCreatePollDrafts() { | |||
return hasTalkFeature(this.token, 'talk-polls-drafts') && this.$store.getters.isModerator |
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.
this.$store.getters.isModerator
is checking moderation against the token from root 💀
@@ -223,14 +225,15 @@ async function createPoll() { | |||
/** | |||
* Pre-fills form from the draft | |||
* @param id poll draft ID | |||
* @param isAlreadyOpened poll draft ID | |||
* @param fromDrafts whether editor was opened from drafts handler |
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.
fromDrafts
can be used to hide "Browse poll drafts" button as it feels repetitive and user would intuitively pick from the poll drafts handler rather then browsing from that button (when it is opened in lobby settings or shared Items tab).
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.
Also, not related but todo, hide/disable export poll button when the poll inputs are all empty
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.
Minor: we need a loading state while the poll drafts are being fetched.
@@ -289,7 +292,7 @@ async function createPollDraft() { | |||
* Open a PollDraftHandler dialog | |||
*/ | |||
function openPollDraftHandler() { | |||
EventBus.emit('poll-drafts-open') | |||
EventBus.emit('poll-drafts-open', {}) |
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.
Selector needs to be passed here, as the editor can be opened in settings (create a new poll) so clicking "back" mounts the drafts handler correctly
import { hasTalkFeature } from '../../services/CapabilitiesManager.ts' | ||
import { EventBus } from '../../services/EventBus.ts' | ||
|
||
const store = useStore() |
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.
not used
showPollDraftHandler.value = false | ||
}) | ||
} | ||
|
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'd say to not to block it, as the other conversation settings are also accessible, so we keep the same pattern |
☑️ Resolves
🖌️ UI Checklist
🖼️ Screenshots / Screencasts
🚧 Tasks
🏁 Checklist