-
Notifications
You must be signed in to change notification settings - Fork 289
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
New feature: Polls #243
New feature: Polls #243
Conversation
Nice :-) |
interesting... |
why not just make it a different kind? it feels wrong using reactions for this. |
we don't need a NIP yet, we just can just choose something and spec it after |
but if you want to go for it lol |
agreed, go and we gonna support both in the future if poll nip is accepted @jb55 |
I added the code of the NIP 41, when it will be accepted, I will change again the code if needed it will be ready to be merged :) |
NIP 41 ref: nostr-protocol/nips#148 |
Would look cool with the linear gradient for the bars :-)
|
Will add it today, thanks :) |
What does the Ui look like whilst creating the poll? |
With regards to the post button - was thinking better UX/UI would be to display but greyed out until created a message? (As apposed to hide, where I've thought to myself "if i write this message how will I be able to post it?") |
Will add it too :) |
(That's generic to all posts) |
this needs to be its own view instead of putting in eventview |
let filtered_choices = choices.filter({ poll_results_everyone ? true : damus.contacts.is_in_friendosphere($0.0) }) | ||
let total_count = filtered_choices.count == 0 ? 1 : filtered_choices.count | ||
|
||
VStack(alignment: .leading, spacing: 15) { |
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 should be its own view
@@ -21,6 +21,10 @@ struct ConfigView: View { | |||
@State var relays: [RelayDescriptor] | |||
@EnvironmentObject var user_settings: UserSettingsStore | |||
|
|||
/// True = poll will display votes from everyone, false = poll will display votes from friends only (and friends of friends) | |||
/// This option is included because of the potential problem with bots. | |||
@AppStorage("poll_results_everyone") var poll_results_everyone: Bool = 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've never used AppStorage before. Does this just save it in UserSettings? I eventually want to scope user settings by pubkey so maybe its best to have it in there
let likes_content = ["👍", "+", "🤙"] | ||
|
||
if !likes_content.contains(ev.content) { | ||
return | ||
} |
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.
Looks like this should be removed?
|
||
|
||
if displayPolls { | ||
VStack(alignment: .leading, spacing: 15) { |
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 needs its own view
closing this for now since it's pretty out of date |
Hello everyone,
I have developed a poll feature for Damus that uses Nostr's reaction kind 7 to allow for voting.
In Damus options, the user can choose to see the votes of their friends as well as their friends' friends, or from everyone. By default, it is set to friends + friends' friends to prevent bots from spamming opinions.
It is now possible to create polls directly from the post writing panel.
I have also included a fix in this PR that prevents Damus from associating any reaction to a like, which was previously the case even if it was a thumbs down for the example.
I hope you enjoy it, I have also included a screenshot here: