Jdlrobson has submitted this change and it was merged.

Change subject: Story 438: Log uploads from nearby and watchlist
......................................................................


Story 438: Log uploads from nearby and watchlist

Sets a cookie with a short life time (1 minute)
If that cookie is present on loading the article page it becomes
the funnel.

Change-Id: I55ca707b41d49859a1f783fb5b7e8fb8179f4946
---
M javascripts/specials/nearby.js
M javascripts/specials/uploads.js
M javascripts/specials/watchlist.js
3 files changed, 11 insertions(+), 2 deletions(-)

Approvals:
  Jdlrobson: Verified; Looks good to me, approved



diff --git a/javascripts/specials/nearby.js b/javascripts/specials/nearby.js
index d579516..d9be686 100644
--- a/javascripts/specials/nearby.js
+++ b/javascripts/specials/nearby.js
@@ -92,6 +92,10 @@
                        el: $content[0],
                        pages: pages
                } );
+               $content.find( 'a' ).on( 'mousedown', function() {
+                       // name funnel for watchlists to catch subsequent 
uploads
+                       $.cookie( 'mwUploadsFunnel', 'nearby', { expires: new 
Date( new Date().getTime() + 60000) } );
+               } );
        }
 
        function findResults( lat, lng ) {
diff --git a/javascripts/specials/uploads.js b/javascripts/specials/uploads.js
index 4bc6f72..9264708 100644
--- a/javascripts/specials/uploads.js
+++ b/javascripts/specials/uploads.js
@@ -166,7 +166,7 @@
                        new photo.PhotoUploader( {
                                buttonCaption: mw.msg( 
'mobile-frontend-photo-upload-generic' ),
                                pageTitle: mw.config.get( 'wgTitle' ),
-                               funnel: 'uploads'
+                               funnel: $.cookie( 'mwUploadsFunnel' ) || 
'uploads'
                        } ).
                                appendTo( $container ).
                                on( 'success', function( image ) {
diff --git a/javascripts/specials/watchlist.js 
b/javascripts/specials/watchlist.js
index 1981f9c..7720be1 100644
--- a/javascripts/specials/watchlist.js
+++ b/javascripts/specials/watchlist.js
@@ -2,9 +2,14 @@
        var star = M.require( 'watchstar' );
 
        function init() {
+               var $watchlist = $( 'ul.mw-mf-watchlist-results' );
                // FIXME: find more elegant way to not show watchlist stars on 
recent changes
                if ( $( '.mw-mf-watchlist-selector' ).length === 0 ) {
-                       star.initWatchListIconList( $( 
'ul.mw-mf-watchlist-results' ), true );
+                       star.initWatchListIconList( $watchlist, true );
+                       $watchlist.find( 'a.title' ).on( 'mousedown', 
function() {
+                               // name funnel for watchlists to catch 
subsequent uploads
+                               $.cookie( 'mwUploadsFunnel', 'watchlist', { 
expires: new Date( new Date().getTime() + 60000 ) } );
+                       } );
                }
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/58641
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I55ca707b41d49859a1f783fb5b7e8fb8179f4946
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to