Skip to content

Show user talk notifications #7

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
nicolas-raoul opened this issue Sep 30, 2015 · 31 comments · Fixed by #1272
Closed

Show user talk notifications #7

nicolas-raoul opened this issue Sep 30, 2015 · 31 comments · Fixed by #1272

Comments

@nicolas-raoul
Copy link
Member

Notify when a user talk message is received, or when a picture is nominated for deletion or modified etc

This is important so that users get notified of feedback like "Please don't upload pictures of recent copyrighted paintings" or "Where was picture X taken?" or "Please categorize using X rather than Y" or "Please provide better description".

@nicolas-raoul
Copy link
Member Author

Touching a notification would open a browser

@whym
Copy link
Collaborator

whym commented Jun 23, 2016

Showing notifications would also help the user realize copyright violations (#97) they might be making. Chances are that app-only users don't read talk pages and notifications, resulting in miscommunication with the community. If I recall it correctly, one of the major concerns of the community against new mobile users was this.

If some of the notifications be made directly visible in the app itself, that would be handy. As a first step, giving hyperlinks to messages readable on the website would be useful, too.

See also https://www.mediawiki.org/wiki/Notifications/API .

(reposted from the duplicate issue I created above)

@nicolas-raoul
Copy link
Member Author

Great tip thanks!

Do you think you could implement this? :-)

We don't really need to actively listen for incoming messages real-time, I guess checking once in a while (for instance 5 seconds after the app is launched) would be enough.

@nicolas-raoul
Copy link
Member Author

A great implementation of this would show not only "Someone edited your userpage" but instead would show the message they received. This is not easy, because such message often include templates. Here is an example I received recently:

== [[:File:Hall and entrance of The Pokémon Company in Tokyo.jpg]] ==
{{Autotranslate|1=File:Hall and entrance of The Pokémon Company in Tokyo.jpg|2=|3=|base=Idw}} [[User:Ubcule|Ubcule]] ([[User talk:Ubcule|<span class="signature-talk">{{int:Talkpagelinktext}}</span>]]) 21:07, 3 August 2016 (UTC)

We have several options:

  • Scrap the rendered HTML and show it in a webview
  • Scrap the wikitext and render it using the Wikimedia API
  • Scrap the wikitext and render it ourselves, for instance recognizing "idw" and showing the right localized message for it (probably hard to maintain)

@misaochan
Copy link
Member

A few points of discussion:

  1. Which notifications exactly do we want to display? User talk & picture nominated for deletion are definitely needed. But what else should/can we show? I'm not sure we want to display notification of modifications as the app submits a modification for EVERY upload (this is how the category selection goes through even though the upload has already started).

  2. How do we want these to be displayed in the UI? We will have a panel in the overhauled main UI where notifications are displayed, but we can really just display 1 account notification and 1 nearby notification in that space. Should we have an additional activity (accessible via nav drawer) that displays all the account notifications, and only display the latest one in the main UI?

@nicolas-raoul
Copy link
Member Author

About (1): It would already be wonderful if we could just get the alerts that can be seen at your https://commons.wikimedia.org/wiki/Special:Notifications either via API or scraping. Example:
screenshot from 2017-07-12 21-18-50

@misaochan
Copy link
Member

Nice, sounds like a plan! Will have to check and see if the API linked by @whym is able to display all of that, though.

@misaochan
Copy link
Member

misaochan commented Oct 25, 2017

This has been included in the IEG renewal and will be implemented in the near future. I am fleshing out the details for the task below, feedback/suggestions welcome.

Use case:
We intend to notify users in the app when a user talk message is received, or if a picture they uploaded is nominated for deletion. This aims to ensure that users are notified of feedback and deletions, similar to how they would if they were using the standard browser-based Upload Wizard, so they can learn from their mistakes.

Scope:

@janpio
Copy link
Contributor

janpio commented Oct 25, 2017

Check [...] each time user starts the app

From experience: This won't be enough. There will be uses that start the app once and have it running "forever".
You should add at least "resume" and probably specific in app events (uploaded picture, refreshed upload list, ...) as triggers as well.

You might also want to investigate if you can "piggyback" these calls on other requests that are already done. Some APIs allow to request two types ob objects at the same time, so you could e.g. get all uploads and notifications with one request.

@neslihanturan
Copy link
Collaborator

I agree @janpio about refreshing notification by events.

Clicking each message/deletion would bring the user to the corresponding User talk section in a WebView (e.g. https://commons.wikimedia.org/wiki/User_talk:Misaochan#File:Carpet_4.jpg )

I think user might want to make requested changes by WebView or app. We should give two buttons to redirect to our MediaDetail view or WebView.

A question: Did we ever considered to add "delete" option like modify option?

@misaochan
Copy link
Member

misaochan commented Oct 25, 2017

@janpio Good point, we should check onResume as well, at least. I've modified the scope with that. I'm on the fence re: checking with other events like picture uploads - depends on how much complexity it would add to the feature I guess.

@neslihanturan AFAIK deletion in Commons is not as straightforward as modifications - I don't think anyone can straight up delete their images, they have to nominate them for deletion. We could add a "nominate for deletion" option, though.

Both modifications and deletion nominations would be a future addition I think, as we might not have time for that in this round. Allowing the user to make changes to category/desc/etc in-app is planned for the 2018 WMCZ round #865

@neslihanturan
Copy link
Collaborator

neslihanturan commented Nov 15, 2017

Hi, here is my suggestion for notifications display. User can click and go to the site. What do you think?
talkpage

@misaochan
Copy link
Member

Great job @neslihanturan ! Looks good to me. :)

@maskaravivek
Copy link
Member

maskaravivek commented Jan 14, 2018

I was in the process of implementing this for our app. The progress on this task is that I am able to successfully fetch the notifications using media wiki APIs.

The MediaWiki notifications API gives all the notifications for a selected wiki/list of wikis.

  • How should I decide what all notifications should be shown in the app and what not to show.
  • Also on checking out the API response it seems the notifications actually just contain the keyword and its the responsibility of the client to sugarcoat it.
    For eg. heres a notification that i received.
{
                    "wiki": "commonswiki",
                    "id": "3464",
                    "type": "welcome",
                    "category": "system",
                    "timestamp": {
                        "utciso8601": "2017-11-01T18:16:21Z",
                        "utcunix": "1509560181",
                        "unix": "1509560181",
                        "utcmw": "20171101181621",
                        "mw": "20171101181621",
                        "date": "1 November"
                    },
                    "agent": {
                        "id": 1725,
                        "name": "Maskaravivek"
                    },
                    "targetpages": []
                }

And this is how it shows in my web browser, which suggests a lot of stitching needs to be done by the client.

screen shot 2018-01-14 at 6 36 44 am

Try out the API in sandbox.
https://commons.wikimedia.beta.wmflabs.org/wiki/Special:ApiSandbox#action=query&format=json&meta=notifications

@misaochan @nicolas-raoul

@nicolas-raoul
Copy link
Member Author

The welcome notification that you took as an example probably does not contain much, indeed.
I think we should catch these two kinds of notifications, which have more information:

Someone nominated one of my uploads for deletion:

screenshot from 2018-01-14 19-52-51

Someone thanked me for an edit (such as selecting categories) or for an upload:

screenshot from 2018-01-14 19-53-28

In both cases I am pretty sure we have a way to get the identifier of the image in question.

@misaochan
Copy link
Member

How should I decide what all notifications should be shown in the app and what not to show.

Glancing at the list of notification types - https://www.mediawiki.org/wiki/Help:Notifications/Notifications_types , my vote would be for:

At minimum:

  • Talk page messages
  • Deletions - actually, is this the same as "Edit reverts"? Or does Commons just use talk page messages for this purpose? @nicolas-raoul any idea?

Nice to have:

  • Thanks
  • Milestone
  • LoginNotify

@maskaravivek
Copy link
Member

Cool thanks @misaochan. I will add support for the above types.

I found an interesting bug while implementing this feature. If i do a fresh login and try to check the notifications, I am able to fetch it using the media wiki api.
However, in subsequent sessions, the API throws an error "You must be logged in to use this API". Seems theres some bug in our media wiki api implementation. @psh Do you have any insights on why this might be happening.

@maskaravivek
Copy link
Member

Heres the complete list of notifications supported by commons. https://commons.wikimedia.beta.wmflabs.org/wiki/Special:DisplayNotificationsConfiguration

@misaochan
Copy link
Member

Copied over from #1089 :

Changes needed before this feature is release-ready:

  • Newest notifications should be on the top, as @whym suggested
  • The "Notifications" item in the nav drawer should be nearer the top, possibly between Nearby and About, not at the bottom of the list (sorry, I know this is temporary and will not matter once we get the main screen UI overhaul done, but for the time being a reordering would make sense)
  • Deletion messages are not made explicit enough. For instance, in the screenshot below, one of the talk page messages was actually an image being nominated for deletion. Unfortunately, it seems that this might be more complicated than we thought it would be, since it appears that Commons does not actually use "Edit revert" notifications to notify about image deletions, but rather just talk messages. However, IMO it is REALLY important that deletion talk messages are explicitly shown as such (for instance, the email notification I received said "File:Apron from Swiss souvenir shop.jpg has been listed at Commons:Deletion requests"). The user should not need to click on the talk page message to know that it is a deletion nomination.
  • Tapping on the talk page message brings the user to top of their talk page, not to the message itself. Especially given that the notification preview doesn't display much information, I think it is important that they are brought to the section with the relevant message.

Things that will need to be discussed further:

  • It appears that Commons automatically sends thanks for every edit (I didn't know that). Unfortunately, this might mean that displaying "thanks" notifications might be somewhat pointless, since our app submits an edit for every image.

@neslihanturan
Copy link
Collaborator

I agree with all bullets except

It appears that Commons automatically sends thanks for every edit (I didn't know that). Unfortunately, this might mean that displaying "thanks" notifications might be somewhat pointless, since our app submits an edit for every image.

I think it can be nice to see thanks notifications also. To make sure the file is uploaded to commons server.

@nicolas-raoul
Copy link
Member Author

Is there a way to filter these specific thanks? Or to only show thanks that are related to an upload rather than an edit?

@misaochan
Copy link
Member

Thanks for the PRs @maskaravivek , we have now fixed Requirement 1 and 2. What are the issues preventing 3 and 4 that you mentioned in our conversation?

@maskaravivek
Copy link
Member

The notifications API doesn't contain any information that i can possibly use to show that the talk message is actually about an image being nominated for deletion.

The API response contains the following data for the image being nominated for deletion message.

Notification as seen on Commons:
screen shot 2018-02-27 at 4 54 17 am

API Response for the same notification:

{
                    "wiki": "commonswiki",
                    "id": "4789263",
                    "type": "edit-user-talk",
                    "category": "edit-user-talk",
                    "timestamp": {
                        "utciso8601": "2017-05-20T09:24:35Z",
                        "utcunix": "1495272275",
                        "unix": "1495272275",
                        "utcmw": "20170520092435",
                        "mw": "20170520092435",
                        "date": "20 May"
                    },
                    "title": {
                        "full": "User talk:Maskaravivek",
                        "namespace": "User_talk",
                        "namespace-key": 3,
                        "text": "Maskaravivek"
                    },
                    "agent": {
                        "id": 3768717,
                        "name": "Arthur Crbz"
                    },
                    "revid": 244738588,
                    "read": "20170520160421",
                    "targetpages": []
                }

So it won't be possible to show what the message is about if we continue using the Mediawiki API. At the same time i am not sure how feasible is the scrapping option.

Moreover apart from this talk message I received another notification which displays as shown below on Commons website.

screen shot 2018-02-27 at 4 57 39 am

For this notification I have sufficient information to display. The API response contains the following:

{
                    "wiki": "commonswiki",
                    "id": "4789261",
                    "type": "mention",
                    "category": "mention",
                    "timestamp": {
                        "utciso8601": "2017-05-20T09:24:33Z",
                        "utcunix": "1495272273",
                        "unix": "1495272273",
                        "utcmw": "20170520092433",
                        "mw": "20170520092433",
                        "date": "20 May"
                    },
                    "title": {
                        "full": "Commons:Deletion requests/Files uploaded by Maskaravivek",
                        "namespace": "Commons",
                        "namespace-key": 4,
                        "text": "Deletion requests/Files uploaded by Maskaravivek"
                    },
                    "agent": {
                        "id": 3768717,
                        "name": "Arthur Crbz"
                    },
                    "revid": 244738579,
                    "read": "20170520160412",
                    "targetpages": []
                }

And the app displays this notification as below:

deletion_request.

Is deletion request different from image getting nominated for deletion?

@maskaravivek
Copy link
Member

Also for point number (4) the API doesn't return sufficient information. This is the response I receive:

{
                    "wiki": "commonswiki",
                    "id": "4789263",
                    "type": "edit-user-talk",
                    "category": "edit-user-talk",
                    "timestamp": {
                        "utciso8601": "2017-05-20T09:24:35Z",
                        "utcunix": "1495272275",
                        "unix": "1495272275",
                        "utcmw": "20170520092435",
                        "mw": "20170520092435",
                        "date": "20 May"
                    },
                    "title": {
                        "full": "User talk:Maskaravivek",
                        "namespace": "User_talk",
                        "namespace-key": 3,
                        "text": "Maskaravivek"
                    },
                    "agent": {
                        "id": 3768717,
                        "name": "Arthur Crbz"
                    },
                    "revid": 244738588,
                    "read": "20170520160421",
                    "targetpages": []
                }

So it won't be possible to redirect the user to the message section. I can at best simply construct the talk page URL.

It would be great if someone could provide some insights on the issues (3) and (4).

@whym
Copy link
Collaborator

whym commented Feb 27, 2018

Regarding detecting deletion requests, some pattern matching might work well enough.

In the API response (at least one used in MediaWiki itself) we have relevant URLs.

screenshot from 2018-02-27 09-09-54

"primary" attribute under "links" contain the section name - you can look for the string "Notification_about_possible_deletion" here. And "secondary" contains the relevant diff URLs and if you retrieve the contents of diff, you can look for:

Regular deletion candidate (using the "Idw" template) - example: https://commons.wikimedia.org/w/index.php?title=User_talk:Kglive&diff=261848528&oldid=254797499

Speedy deletion candidate (using the "Copyvionote" template) - example: https://commons.wikimedia.org/w/index.php?title=User_talk:Kglive&diff=prev&oldid=236984458

There might be other variations of deletion request messages, but I believe these two are the most common ones.

The api query above was sent by MediaWiki, https://commons.wikimedia.beta.wmflabs.org/w/api.php?action=query&format=json&formatversion=2&meta=notifications&notsections=alert&notformat=model&notlimit=25&notprop=list%7Ccount%7CseenTime&uselang=en&notcrosswikisummary=1&notunreadfirst=1&notbundle=1&_=1519689342745 - is this the same endpoint the app is using, right?

@maskaravivek
Copy link
Member

Thanks for the tip @whym! I wasn't sending some of these query params so the response that I got didn't contain all this information. I will incorporate these changes.

@maskaravivek
Copy link
Member

@nicolas-raoul It is possible to just get the alerts as you commented above from the notifications API. Do we want to show just the alerts, or all notifications?

@nicolas-raoul
Copy link
Member Author

I was not sure what the difference between alert/notification is, to here are real-life screenshots for reference:
screenshot from 2018-03-08 11-22-03
screenshot from 2018-03-08 11-21-32
All of these are worth showing to the user.
Mentions are especially useful to notify the user about possible copyright violations (ex: the user uploaded a picture of their painting, and Commons patrollers suspect they are actually not the painter. With the notification, the uploader gets a chance to explain themselves).

@maskaravivek
Copy link
Member

@nicolas-raoul One difference that I noticed is that when I add a parameter to fetch just the alerts, then the thank-you-edit notifications are not returned.

@nicolas-raoul
Copy link
Member Author

How about fetching everything, and then filtering out the thank-you-edit only?
The web interface does not show them, so it must have a way to differentiate them.

@maskaravivek
Copy link
Member

Yes, thats entirely possible. Will make this change in my PR.

sivaraam pushed a commit to sivaraam/apps-android-commons that referenced this issue Dec 23, 2018
ashishkumar468 pushed a commit to ashishkumar468/apps-android-commons that referenced this issue Aug 8, 2019
Added setOffscreenPageLimit in ViewPager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants