Guard copy actions when no report is generated#576
Open
Myst1C13 wants to merge 1 commit intofossasia:mainfrom
Open
Guard copy actions when no report is generated#576Myst1C13 wants to merge 1 commit intofossasia:mainfrom
Myst1C13 wants to merge 1 commit intofossasia:mainfrom
Conversation
Contributor
Reviewer's GuideAdds a shared helper to determine whether a scrum report has meaningful content and uses it to guard copy/insert actions (including keyboard shortcuts) so they do nothing when no report is present, avoiding misleading "Copied!" behavior. Sequence diagram for guarded copy via keyboard shortcutsequenceDiagram
actor User
participant Document
participant KeydownHandler
participant hasScrumReportContent
participant copyBtn
participant ScrumReportEl
User->>Document: Press modifier+Shift+Y
Document->>KeydownHandler: keydown event
KeydownHandler->>KeydownHandler: Check modifier, shift, alt, repeat, copyBtn state
KeydownHandler->>hasScrumReportContent: hasScrumReportContent()
hasScrumReportContent->>ScrumReportEl: getElementById(scrumReport)
alt Scrum report element missing
hasScrumReportContent-->>KeydownHandler: false
KeydownHandler-->>Document: Do nothing
else Scrum report element present
hasScrumReportContent->>ScrumReportEl: Read textContent and innerHTML
hasScrumReportContent-->>KeydownHandler: true if non empty
alt Report has content
KeydownHandler->>Document: preventDefault()
KeydownHandler->>Document: showShortcutNotification(copyingReportNotification)
KeydownHandler->>copyBtn: _triggeredByShortcut = true
KeydownHandler->>copyBtn: click()
else Report empty
KeydownHandler-->>Document: Do nothing
end
end
Sequence diagram for guarded copy via button clicksequenceDiagram
actor User
participant copyBtn
participant hasScrumReportContent
participant ScrumReportEl
participant Document
User->>copyBtn: click
copyBtn->>ScrumReportEl: getElementById(scrumReport)
copyBtn->>hasScrumReportContent: hasScrumReportContent(ScrumReportEl)
alt No scrum report content
hasScrumReportContent-->>copyBtn: false
copyBtn->>copyBtn: _triggeredByShortcut = false
copyBtn-->>User: No feedback, no copy
else Scrum report has content
hasScrumReportContent-->>copyBtn: true
copyBtn->>Document: createElement(div) as tempDiv
copyBtn->>tempDiv: innerHTML = ScrumReportEl.innerHTML
copyBtn->>Document: appendChild(tempDiv)
copyBtn->>Document: select tempDiv content
copyBtn->>Document: execCommand(copy)
copyBtn->>Document: removeChild(tempDiv)
copyBtn-->>User: Show Copied feedback
end
Flow diagram for hasScrumReportContent helper logicflowchart TD
A["Call hasScrumReportContent with optional scrumReportEl or default getElementById(scrumReport)"] --> B{scrumReportEl exists?}
B -- No --> C[Return false]
B -- Yes --> D["Read textContent and innerHTML from scrumReportEl"]
D --> E{"Any non empty trimmed content?"}
E -- No --> C
E -- Yes --> F[Return true]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Author
|
Fixed the empty-report copy state issue by guarding copy/insert actions when no report content is present. Happy to make any follow-up changes if needed. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Copied!when no scrum report has been generatedTesting
src/scripts/popup.jsSummary by Sourcery
Guard copy-related actions behind a shared scrum report content check to avoid acting when no report is available.
Bug Fixes:
Enhancements: