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

From Wikitech

Compatible with:

title Wikidata Bridge

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

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


alt edit permissions: client
  alt Javascript enabled
    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:check repo/client edit permissions
      WB API->Bridge:permissions
      Bridge->WB API:request property label
      WB API->Bridge:property label
      Bridge->WB API:request config
      WB API->Bridge:config
      Bridge->WB API:request entity
      WB API->Bridge:entity
    end

    alt edit permissions: repo + client (some additional)
      alt value is supported by bridge, property is elegible for bridge
        Bridge->tracking: track opening
        note over Bridge: shows input field(s)
        User->Bridge: enters new value, takes edit decision, clicks save
        
        note over Bridge: shows saving indicator (T237433)

        Bridge->WB API: saves value
        Bridge->WP article: purge article cache (T235208)
        Bridge->User: trigger reload (T235208)
        User->WP article: sees update values
        
        note over User: bliss
      else
        note over Bridge: displays bail-out message + fallback link to wikidata
        User->Bridge: clicks fallback link
        User-->WB GUI: fall back to wikidata (e.g. if bridge does not support this value type yet)
      end
    else
      note over Bridge: display permission error
    end
  else
    User->WP article: clicks native link
    User-->WB GUI: goes to wikidata
  end
else
  Bridge->WP article: hide edit link(s) (T235152)
end