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

[GSoC'24] CardBrowser: Shortcut E #16814

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

SanjaySargam
Copy link
Contributor

@SanjaySargam SanjaySargam commented Aug 3, 2024

Purpose / Description

This PR is a part of #16795

How Has This Been Tested?

HP Chromebook

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@SanjaySargam SanjaySargam added the GSoC Pull requests authored by a Google Summer of Code participant [Candidate/Selected], for GSoC mentors label Aug 3, 2024
@david-allison
Copy link
Member

@SanjaySargam What's pending before this becomes ready to review?

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Aug 3, 2024
@SanjaySargam SanjaySargam marked this pull request as ready for review August 3, 2024 15:44
Copy link
Member

@Arthur-Milchior Arthur-Milchior left a comment

Choose a reason for hiding this comment

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

only nit. If you only change comment/documentation we can merge immediately

@@ -718,10 +721,19 @@ open class CardBrowser :
viewModel.endMultiSelectMode()
}

private suspend fun getCardIdForNoteEditor(): CardId {
// Just select the first one. It doesn't particularly matter if there's a multiselect occurring.
Copy link
Member

Choose a reason for hiding this comment

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

I admit I don't understand the "doesn't particularly matter". That does not seems obvious to me.
And in particular, it seems it should be if part of the if/else.
Because that's the only place where we consider the case where there is indeed multiple selections.

@david-allison
Copy link
Member

What if there's no cards?

@Arthur-Milchior
Copy link
Member

@david-allison If there is no card, it edit the first card of the search result.
Which is what I was asking him to document

@david-allison
Copy link
Member

david-allison commented Aug 4, 2024

What if there are no cards in the deck/collection?

@SanjaySargam
Copy link
Contributor Author

What if there are no cards in the deck/collection?

It show toast as Something went wrong

    private fun openNoteEditorForCurrentlySelectedNote() = launchCatchingTask {
        try {
            val cardId = getCardIdForNoteEditor()
            openNoteEditorForCard(cardId)
        } catch (e: Exception) {
            Timber.w(e, "Error Opening Note Editor")
            showSnackbar(
                R.string.multimedia_editor_something_wrong,
                Snackbar.LENGTH_LONG
            )
        }
    }

@SanjaySargam SanjaySargam removed the Needs Author Reply Waiting for a reply from the original author label Aug 4, 2024
@david-allison
Copy link
Member

It should do something more user-friendly. It's an expected 'error' case

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Aug 4, 2024
@SanjaySargam
Copy link
Contributor Author

@david-allison Should I change toast as No note to open NoteEditor?

@david-allison
Copy link
Member

I'd go with No note to edit

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Unit tests would be great here

@david-allison david-allison added Strings and removed Needs Author Reply Waiting for a reply from the original author Needs Review labels Aug 4, 2024
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Awaiting Sanjay's approval: either waiting for tests, or merging as-is

@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) labels Aug 4, 2024
@SanjaySargam
Copy link
Contributor Author

Unit tests would be great here

I'll add in separate PR

Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

This should only show no note to edit if there's no note to edit. Not on any failure.

Copy link
Contributor Author

@SanjaySargam SanjaySargam left a comment

Choose a reason for hiding this comment

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

Self high-five! Approved!

@Arthur-Milchior
Copy link
Member

Sorry @SanjaySargam you won't get the 2nd approval right now. David make a useful remark. You should show the new message if no notes are selected. If there is any other error, then there should be no changes

@SanjaySargam SanjaySargam removed the Needs Author Reply Waiting for a reply from the original author label Aug 7, 2024
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Beautiful, thanks for taking the time with this one

@david-allison david-allison added this pull request to the merge queue Aug 7, 2024
@david-allison david-allison removed this pull request from the merge queue due to a manual request Aug 7, 2024
@david-allison
Copy link
Member

Blocked on translation sync

@david-allison david-allison added this pull request to the merge queue Aug 8, 2024
Merged via the queue into ankidroid:main with commit 436d84b Aug 8, 2024
8 checks passed
@github-actions github-actions bot added this to the 2.19 release milestone Aug 8, 2024
Copy link
Contributor

github-actions bot commented Aug 8, 2024

Maintainers: Please Sync Translations to produce a commit with only the automated changes from this PR.

Read more about updating strings on the wiki,

@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC Pull requests authored by a Google Summer of Code participant [Candidate/Selected], for GSoC mentors Strings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants