User:Pablo Grass (WMDE)/wikidata/data-bridge/sequence

From Wikitech
Revision as of 18:43, 10 October 2019 by Pablo Grass (WMDE) (talk | contribs) (illustrate link destruction on client permission problem, add purging and reloading after successful save)

Compatible with:

title Wikidata Bridge

actor User
participantgroup **Client (wikipedia)**
  participant WP article
  participant Bridge
end
participantgroup **Repo (wikidata)**
  participant WB API
  participant WB GUI
end

User->WP article: reads
note over WP article: infobox

alt Javascript enabled
  alt client edit permissions
    Bridge->WP article: overload links
    note over WP article: infobox w/\nlinks on steroids

    User->WP article: clicks link on steroids

    WP article->Bridge: Params:\n- item id\n- property id\n- specific statement (day 2)\n- edit strategy?\n- user
    
    note over Bridge: opens with loading indicator\n(T232468)
    
    par in parallel
      Bridge->WB API:request entity
      WB API->Bridge:entity
    else
      Bridge->WB API:check repo edit permissions
      WB API->Bridge:permission
    end

    alt repo edit permissions
      alt value is supported by bridge, property is elegible for bridge
        note over Bridge: shows input field(s)
        User->Bridge: enters new value, clicks save
        
        note over Bridge: shows saving indicator

        Bridge->WB API: saves value
        Bridge->WP article: purge article cache
        Bridge->User: trigger reload
        User->WP article: sees update values
        
        note over User: bliss
      else
        note over Bridge: displays error message + fallback link to wikidata
        User->Bridge: clicks fallback link
        User-->WB GUI: fall back to wikidata (bridge does not support this value type yet)
      end
    else
      note over Bridge: display permission problem message
    end
  else
    Bridge->WP article: destroy link
  end
else
  User->WP article: clicks native link
  User-->WB GUI: goes to wikidata
end