Skip to content

Todo for user #3851

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

Merged
merged 34 commits into from
Aug 17, 2020
Merged

Todo for user #3851

merged 34 commits into from
Aug 17, 2020

Conversation

neslihanturan
Copy link
Collaborator

@neslihanturan neslihanturan commented Jun 29, 2020

Description (required)
Fixes #1870
You can see the todo warning to improve the quality of the image below

After selecting edit icon, a filter will appear

Then after selecting and clicking to update categories button category will be added

Note: I didn't preferred to add an icon to contributions list to indicate the todo list, since #3783 also adds an icon to contributions list. Two different icons for almost same thing would be confusing. I think after this PR is merged, we should move wikipedia association button to inside (media details fragment) and todo (for missing category and wikipedia association) to outside (category list).

Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

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

Could you please add tests to make sure this change works as expected?

@neslihanturan neslihanturan changed the title Todo for user [WIP] Todo for user Jun 29, 2020
@neslihanturan neslihanturan marked this pull request as draft June 29, 2020 12:41
@neslihanturan neslihanturan changed the base branch from master to contributions-todo July 3, 2020 14:06
@neslihanturan neslihanturan changed the base branch from contributions-todo to master July 3, 2020 14:37
@neslihanturan neslihanturan marked this pull request as ready for review July 7, 2020 23:17
@misaochan misaochan changed the title [WIP] Todo for user Todo for user Jul 8, 2020
@misaochan
Copy link
Member

Thanks for the PR @neslihanturan . These are quite substantial changes, could you add unit tests to your PR please? :)

I will test this tomorrow, @maskaravivek or @ashishkumar468 it would be great if one of you could do a code review.

<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please reset this

@@ -325,4 +325,4 @@
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didnt add any new lines at the and of the file, I dont get what this change is. Any idea?

@misaochan
Copy link
Member

misaochan commented Jul 11, 2020

Did you try to close the keyboard, then it should be there

Yes, as you can see in my second screenshot the keyboard is closed (otherwise the list of categories would not even be displayed).

Actually I intentionally implemented this feature (not a bug:D) to east give a way to close it.

IMO for a dialog that requires a lot of tapping, it would be a lot better to have an "x" button on the top right to close, rather than closing with every mis-tap. :)

@codecov-commenter
Copy link

Codecov Report

Merging #3851 into master will decrease coverage by 0.14%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master   #3851      +/-   ##
===========================================
- Coverage      8.69%   8.55%   -0.15%     
  Complexity      366     366              
===========================================
  Files           319     321       +2     
  Lines         11774   11971     +197     
  Branches        914     937      +23     
===========================================
  Hits           1024    1024              
- Misses        10693   10890     +197     
  Partials         57      57              
Impacted Files Coverage Δ Complexity Δ
...ava/fr/free/nrw/commons/category/CategoryClient.kt 85.71% <ø> (ø) 8.00 <0.00> (ø)
.../free/nrw/commons/category/CategoryEditHelper.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...ategory/CategoryEditSearchRecyclerViewAdapter.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
.../commons/contributions/ContributionViewHolder.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...w/commons/contributions/ContributionsFragment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ommons/contributions/ContributionsListAdapter.java 0.00% <ø> (ø) 0.00 <0.00> (ø)
...mmons/contributions/ContributionsListFragment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...fr/free/nrw/commons/media/MediaDetailFragment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ee/nrw/commons/media/MediaDetailPagerFragment.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...e/nrw/commons/notification/NotificationHelper.java 0.00% <ø> (ø) 0.00 <0.00> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6f4c60b...672b7b0. Read the comment docs.

@neslihanturan
Copy link
Collaborator Author

@misaochan I recognized an issue which is not reported here:
Categories are actually added but since media object is retained from cache (instead of being re-fetched, which makes sense in terms of efficiency) media.getCategories() still returns old category list. There are two possible solution to this.

1- Simple, save categories to media object and display media.getCategories() + new categories to user
2- Not that simple, re-fetch categories, I will need help from @maskaravivek since he has experience about media.kt class


public void updateCategories(List<String> selectedCategories) {
Single<Boolean> resultSingle =reasonBuilder.getReason(media, null)
.flatMap((reason) -> categoryEditHelper.makeCategoryEdit(getContext(), media, selectedCategories, this));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here @ashishkumar468 , there is no need to build a reason. I just tried to mimic the same implementation as deleteHelper which does not raise exception. I don't know what I can put to this line, to be able to call flatMap.

For other implementation, see line 747 of same file

    private void onDeleteClicked(Spinner spinner) {

Copy link
Collaborator

Choose a reason for hiding this comment

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

I could not understand @neslihanturan . What is the issue with this implementation?

Copy link
Collaborator Author

@neslihanturan neslihanturan Jul 27, 2020

Choose a reason for hiding this comment

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

well, I don't need to buıild a reason as "reasonBuilder.getReason(media, null)". It is only a need for deletion request. I used that line just to be able to implement the same structure with line 747. But my rxjava knowledge doesnt help me to find what to put before .flatMap, if not needed. Is it clear now?

@neslihanturan
Copy link
Collaborator Author

neslihanturan commented Aug 11, 2020

@misaochan this one is ready to be tested and probably be merged, after @ashishkumar468 's help:)

@misaochan
Copy link
Member

Hi @neslihanturan , thanks for making the changes! :) It works well for me now, there is just one item from #3851 (comment) that seems to not work:

The area for onClick to search for categories should be wider, probably the entire width of the search icon row. Currently if you tap anywhere except the search icon itself, the dialog disappears

This problem still happens for me. Once this is fixed I am happy to merge.

@@ -598,6 +598,18 @@ Upload your first media by tapping on the add button.</string>
<string name="delete_helper_ask_reason_copyright_logo">Logo</string>
<string name="delete_helper_ask_reason_copyright_other">Other</string>
<string name="delete_helper_ask_alert_set_positive_button_reason">Because it is</string>

<string name="category_edit_helper_make_edit_toast">Trying to update categories.</string>
<string name="category_edit_helper_show_edit_title">Categories are updated</string>
Copy link
Member

@misaochan misaochan Aug 11, 2020

Choose a reason for hiding this comment

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

Based on my interpretation, the notification title would be "Categories are updated: Success" if the categories are successfully updated, and "Categories are updated: Could not add categories" if they are not, right? In that case I think this string should be Category update instead of Categories are updated.

<item quantity="one">Category %1$s is added.</item>
<item quantity="other">Categories %1$s are added.</item>
</plurals>
<string name="category_edit_helper_show_edit_title_failed">Failed</string>
Copy link
Member

Choose a reason for hiding this comment

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

Is this string ever used?

@misaochan
Copy link
Member

Great job @neslihanturan !

@misaochan misaochan merged commit 1856196 into commons-app:master Aug 17, 2020
ashishkumar468 pushed a commit to ashishkumar468/apps-android-commons that referenced this pull request Oct 10, 2020
* Add a simple message

* Categories are edited

* Display categories

* read whole page

* Revert wrong changes

* Add newly added category field

* Doesnt displaey alreasy added categories

* add strings for notifications

* clean code

* Readd accidentally removed imports

* Fix edit layout style

* Fix category update messages

* Pass isWikipediaButtonDisplayed information to fragment

* Remove unused class

* Fix strings

* Fix string

* Add exeption for uncategorised images too

* Revert project.xml changes

* fix update buttonvisibility issue

* Make sure it works for auto added categories too

* make the button visible

* Make the button appear when categories are entered

* Include cancel button

* Make view updated too

* Make category view edited

* Update categories in an hacky way

* Fix unnecessary method call

* Add notes for short term fix to display added category

* Fix tests

* Fix strings

* Fix click issue
ashishkumar468 pushed a commit to ashishkumar468/apps-android-commons that referenced this pull request Oct 10, 2020
* Add a simple message

* Categories are edited

* Display categories

* read whole page

* Revert wrong changes

* Add newly added category field

* Doesnt displaey alreasy added categories

* add strings for notifications

* clean code

* Readd accidentally removed imports

* Fix edit layout style

* Fix category update messages

* Pass isWikipediaButtonDisplayed information to fragment

* Remove unused class

* Fix strings

* Fix string

* Add exeption for uncategorised images too

* Revert project.xml changes

* fix update buttonvisibility issue

* Make sure it works for auto added categories too

* make the button visible

* Make the button appear when categories are entered

* Include cancel button

* Make view updated too

* Make category view edited

* Update categories in an hacky way

* Fix unnecessary method call

* Add notes for short term fix to display added category

* Fix tests

* Fix strings

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

Successfully merging this pull request may close these issues.

"To-do list" for users
4 participants