Skip to content

Commit

Permalink
Use normalised target name in Rating Window and Warning screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Andryukhin committed May 28, 2013
1 parent 6b2446b commit ba796f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion content/warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ wot.warning = {

this.target = data.target;

var normalized_target = (data.cached && data.cached.value &&
data.cached.value.normalized) ? data.cached.value.normalized : data.decodedtarget;

// preprocess link "Rate the site"
var rate_site = wot.i18n("warnings", "ratesite").replace("<a>", "<a id='wotrate-link' class='wot-link'>");
var wt_text_2 = wot.i18n("wt", "warning_text_2") || "";
Expand All @@ -185,7 +188,7 @@ wot.warning = {
to: wot.i18n("warnings", "warning")
}, {
from: "TITLE",
to: (data.decodedtarget || "").replace(/[<>&="']/g, "")
to: (normalized_target || "").replace(/[<>&="']/g, "")

This comment has been minimized.

Copy link
@samitolvanen

samitolvanen May 28, 2013

Contributor

Hmm, is the normalized_target decoded too? I mean, the normalized target could have an encoded path, so it's still necessary to decode it before showing to user. You can test this on Twitter, for example, where every path has a separate reputation.

}, {
from: "LANG",
to: wot.i18n("lang")
Expand Down
3 changes: 2 additions & 1 deletion ratingwindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,12 @@ $.extend(wot, { ratingwindow: {

/* update current rating state */
this.updatestate(this.current.target, cached);
var normalized_target = cached.value.normalized ? cached.value.normalized : this.current.target;

/* target */
if (this.current.target && cached.status == wot.cachestatus.ok) {
$("#wot-title-text").text(
bg.wot.url.decodehostname(this.current.target));
bg.wot.url.decodehostname(normalized_target));
} else if (cached.status == wot.cachestatus.busy) {
$("#wot-title-text").text(wot.i18n("messages", "loading"));
} else if (cached.status == wot.cachestatus.error) {
Expand Down

0 comments on commit ba796f2

Please sign in to comment.