User:Sardisson/Website Version Detection Scratchpad
Right now we (apparently) have to update too many different things to get all of our alert messages changed. We need to try to get this down to a system where we really only have to change one input (the version number[s]) when we release.
According to Sam, we currently display four different messages depending on what Camino you're using.
- If you're on 1.0.x other than 1.0.6, we'll show the "You need to update" message.
- If you're on 1.0.6 we'll show the "You might want to upgrade if you're on 10.3"
- If you're on 1.5 we show the "You need to update" message (but it goes to a different link than the 1.0.x one)
- And if you're on 1.5.1 we show nothing, but it's a specific message.
- There is also a message for users of recent nightlies (and hopefully one for people running nightlies that are too old)
Solution Scratchpad
Define the message text like so:
- msg_legacyBranch: You're using an old version of Camino $(ver_legacyBranch). Please upgrade to $(ver_legacy) [a href=cbo/releases/$(ver_legacy)/] [a href=cbo/download/$(ver_legacy)/] if you are on 10.2, or $(ver_current) [a href=cbo/releases/$(ver_current)/] [a href=cbo/download/$(ver_current)/] if you are on 10.3 or higher.
- msg_legacyBranch_latest:
- msg_currentBranch:
- msg_currentBranch_latest:
- msg_oldNightly: You are using nightly build older than two weeks; please upgrade to a new nightly....
- msg_recentNightly: Thanks for testing; please report any bugs you find.
Define four variables that are updated manually, one set updated with each release and one set only with branch changes:
- ver_legacy = 1.0.6
- ver_current = 1.5.1
- ver_legacyBranch = 1.0
- ver_currentBranch = 1.5
Write our code such that
if userVer = ver_current then show msg_currentRel_latest if userVer = ver_legacy then show msg_legacyRel_latest if userVer matches ver_currentBranch AND userVer < ver_current then show msg_currentBranch if userVer matches ver_legacyBranch AND userVer < ver_legacy then show msg msg_legacyBranch if (nightly) then ... if (otherbrowser) then ...
This basic code is run on every page that does version-or-browser specific messaging (home, start, welcome); if different messages are desired, we just add messages (e.g., msg_homeSafari, msg_homeFirefox, msg_homeCamino) and reuse the same code with a different message branch (set).