bug report #795844 by Peng.Pif,surge_martin: Revised logic around how the link to apply is determined.