-
-
Notifications
You must be signed in to change notification settings - Fork 2
Added "Unlock" Feature #40
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6023d4d
Added "Unlock" Feature;
zapdos26 1046fed
Removed console.log()
zapdos26 64918e2
Removed unnecessary "if" statement
zapdos26 6bbdcc6
Prevent removal of vote options when poll is locked;
zapdos26 1b47bf3
Turned this.isLocked assignment into easier to read if statement
zapdos26 1fdaf34
Add notification to user if their vote was blocked due to it being lo…
zapdos26 b3bedd0
Remove empty votes from results;
zapdos26 e36a1cd
Fixed issue where < was replaced by greater than and vice versa.
zapdos26 48decf4
Fixed spelling issue
zapdos26 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { | ||
| SectionBlock, ContextBlock, PlainTextElement, Option | ||
| SectionBlock, ContextBlock, PlainTextElement, Option, ActionsBlock, Button | ||
| } from "@slack/types"; | ||
|
|
||
| export class Static { | ||
|
|
@@ -8,18 +8,37 @@ export class Static { | |
| } | ||
|
|
||
| public static buildSectionBlock(mrkdwnValue: string): SectionBlock { | ||
| return { type: "section", text: { type: "mrkdwn", text: mrkdwnValue } }; | ||
| return {type: "section", text: {type: "mrkdwn", text: mrkdwnValue}}; | ||
| } | ||
|
|
||
| public static buildContextBlock(mrkdwnValue: string): ContextBlock { | ||
| return { type: "context", elements: [ { type: "mrkdwn", text: mrkdwnValue } ] }; | ||
| return {type: "context", elements: [{type: "mrkdwn", text: mrkdwnValue}]}; | ||
|
zapdos26 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| public static buildSelectOption(text: string, value: string): Option { | ||
| return { text: this.buildTextElem(text), value: value }; | ||
| return {text: this.buildTextElem(text), value: value}; | ||
| } | ||
|
|
||
| public static buildTextElem(text: string): PlainTextElement { | ||
| return { type: "plain_text", text, emoji: true }; | ||
| return {type: "plain_text", text, emoji: true}; | ||
| } | ||
| public static buildVoteOptions(parameters: string [], start: number ): ActionsBlock[] { | ||
| const actionBlocks: ActionsBlock[] = [{ type: "actions", elements: [] }]; | ||
| let actionBlockCount = 0; | ||
| // Construct all the buttons | ||
| for (let i = start; i < parameters.length; i++) { | ||
| if (i % 5 === 0 && i != 0) { | ||
| const newActionBlock: ActionsBlock = { type: "actions", elements: [] }; | ||
| actionBlocks.push(newActionBlock); | ||
|
Comment on lines
+31
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should just make this one line if we're not going to re-use the defined constant again. |
||
| actionBlockCount++; | ||
| } | ||
| // Remove special characters, should be able to remove this once slack figures itself out | ||
| parameters[i] = parameters[i].replace("&", "+").replace("<", "greater than ") | ||
|
zapdos26 marked this conversation as resolved.
Outdated
|
||
| .replace(">", "less than "); | ||
| // We set value to empty string so that it is always defined | ||
| const button: Button = { type: "button", value: " ", text: Static.buildTextElem(parameters[i]) }; | ||
| actionBlocks[actionBlockCount].elements.push(button); | ||
|
Comment on lines
+39
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above. |
||
| } | ||
| return actionBlocks; | ||
| } | ||
| } | ||
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.
Does this mean we're now going to show an option if it has 0 votes?
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.
Originally, yes. However since there appears to be a want for anonymous polling, we can re-add it.
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.
Well even with non anonymous polling we don't want to show votes with 0 people in the results block.
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.
We need to though, otherwise how will we know what the vote options are?
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.
But it looks like you kept the buttons but disabled voting.
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.
There were previous iterations (see previous commits) where the buttons were deleted. However I re-added the buttons since they store information in regards to who voted. Since we kept the buttons, this will be re-added.