Fix regression in profileIndicator
Commit 91c444f introduced a regression since the |query| variable was
removed from inside the encodeURIComponent argument. This CL fixes it.
It also fixes an issue when the URL ends with
/thread/__THREAD_ID__?authuser=__INDEX__.
Bug: twpowertools:96
Change-Id: I4d407a33a7506853b4af7ffb8ef0c1d67fa1d73c
diff --git a/src/injections/profileIndicator.js b/src/injections/profileIndicator.js
index 98c6092..a8381fc 100644
--- a/src/injections/profileIndicator.js
+++ b/src/injections/profileIndicator.js
@@ -213,8 +213,8 @@
var forumId = forumUrlSplit[1].split('/')[0];
var query = '(replier:"' + escapedUsername + '" | creator:"' +
- escapedUsername + '") ' + FILTER_ALL_LANGUAGES;
- var encodedQuery = encodeURIComponent(' forum:' + forumId);
+ escapedUsername + '") ' + FILTER_ALL_LANGUAGES + ' forum:' + forumId;
+ var encodedQuery = encodeURIComponent(query);
var authuserPart =
(authuser == '0' ? '' : '?authuser=' + encodeURIComponent(authuser));
var searchURL = 'https://support.google.com/s/community/search/' +
@@ -304,7 +304,7 @@
if (threadUrlSplit.length < 2)
throw new Error('Can\'t get thread id.');
- var currId = threadUrlSplit[1].split('/')[0];
+ var currId = threadUrlSplit[1].split('?')[0].split('/')[0];
var OPStatus = OP_FIRST_POST;