Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

feat: introduce PollManager #14038

wants to merge 4 commits into from

Conversation

Antreesy
Copy link
Contributor

☑️ Resolves

🖌️ UI Checklist

🖼️ Screenshots / Screencasts

image

🚧 Tasks

  • It's possible to be in conversation1, open settings for conversation2 and create draft/poll in conversation2. Considered OK or we should block it?

🏁 Checklist

@Antreesy Antreesy force-pushed the fix/13439/poll-management branch from f95083c to 7f7cfea Compare December 19, 2024 17:12
@DorraJaouad DorraJaouad self-requested a review January 6, 2025 08:15
Comment on lines +201 to +204
canCreatePollDrafts() {
return hasTalkFeature(this.token, 'talk-polls-drafts') && this.$store.getters.isModerator
&& [CONVERSATION.TYPE.GROUP, CONVERSATION.TYPE.PUBLIC].includes(this.conversation.type)
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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
Copy link
Contributor

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
Copy link
Contributor

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).

Copy link
Contributor

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

Copy link
Contributor

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', {})
Copy link
Contributor

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()
Copy link
Contributor

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
})
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

@DorraJaouad
Copy link
Contributor

It's possible to be in conversation1, open settings for conversation2 and create draft/poll in conversation2. Considered OK or we should block it?

I'd say to not to block it, as the other conversation settings are also accessible, so we keep the same pattern

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to prepare and import/export polls
3 participants