[SUMO] "Firefox user" hard coded for anonymous Forum users

VERIFIED FIXED in 1.4.1

Status

support.mozilla.org
Knowledge Base Software
VERIFIED FIXED
9 years ago
8 years ago

People

(Reporter: jsocol, Assigned: jsocol)

Tracking

unspecified
1.4.1

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: sumo_only, URL)

Attachments

(3 attachments, 2 obsolete attachments)

(Assignee)

Description

9 years ago
This was changed for bug 487175 in r26283. The comments for 487175 describe possible solutions.

Affects the files listend in r26283 and...
 * templates/styles/mozfr/tiki-view_forum.tpl

(there may be others.)
(Assignee)

Comment 1

9 years ago
The issue:
 * The localized string " (Firefox user)" is appended to all unregistered forum poster names.
 * Rather than being displayed, the string is replaced in Smarty template with an unlocalized find/replace.

The planned solution: 
 * Check that no other functions rely on this string.
 * Replace " (Firefox user)" with a product-neutral, non-localized variant, eg: " (anon)".
   * Update `tiki_comments` table `userName` field.
   * Update Smarty templates to look for the new string.
   * Update Smarty templates to localize the output.
(Assignee)

Updated

9 years ago
Assignee: nobody → jsocol
(Assignee)

Comment 2

9 years ago
Created attachment 395416 [details] [diff] [review]
patch, v1

Very simple patch, the real meat of the problem is working through the database and replacing all the localized strings with a common string.
Attachment #395416 - Flags: review?(paul.craciunoiu)
(Assignee)

Updated

9 years ago
Attachment #395416 - Flags: review?(paul.craciunoiu) → review?(laura)
(Assignee)

Comment 3

9 years ago
Created attachment 395676 [details]
Script to update the database


This, with a few minor configuration edits, will update unregistered user names in the database from the old "(not registered)" and its localized versions and the newer "(Firefox user)" to a product- and language-neutral "(anon)".

It ran in about 90 minutes on my little Macbook.
Attachment #395676 - Flags: review?(laura)
(Assignee)

Updated

9 years ago
Attachment #395676 - Attachment mime type: application/octet-stream → text/plain

Comment 4

9 years ago
Comment on attachment 395676 [details]
Script to update the database

A few things:
- Is the regex specific enough?  Did you audit the rows you were altering?
- 90 mins on prod is too long. One alternative is to alter the script to generate a set of SQL stmts, run the script on sumotools, and attach the SQL here to be run on prod.
- I also think this might be able to be sped up by doing it a different way.  Something like:
- retrieve all the distinct matching l10ns using a regex (should be fast)
- for each l10n, run the MySQL REPLACE string function for matching rows.
Attachment #395676 - Flags: review?(laura) → review-

Comment 5

9 years ago
Comment on attachment 395416 [details] [diff] [review]
patch, v1

Most of the lines in the patch aren't changed - I suspect you have a whitespace/line endings issue.
Attachment #395416 - Flags: review?(laura) → review-
(Assignee)

Comment 6

9 years ago
Created attachment 395685 [details] [diff] [review]
patch,v2

Same thing, just fixing any indents.
Attachment #395416 - Attachment is obsolete: true
(Assignee)

Updated

9 years ago
Attachment #395685 - Flags: review?(laura)
(Assignee)

Comment 7

9 years ago
I did audit the matched rows, only the known localizations of "not registered" and "Firefox user" appeared.

Since importing dumps on my local machine takes an unknown number of hours (>5), and I already ran the last script on my copy of the database, I ran this query on tiki_comments:

  UPDATE tiki_comments
  SET userName = REPLACE(userName,'(anon)','(anon2)')
  WHERE userName LIKE '%(anon)';

It ran in 37:33, much faster than issuing lots of update statements--though I still don't consider my laptop a very useful benchmark. My only concern is that REPLACE doesn't discriminate against "John (Firefox user)" (which it should change) and "(Firefox user) John" (which it should not).

Perhaps the best method is to push the code change, get a new dump afterwards, generate individual UPDATE statements (around 126k) and run them in batches during off-peak hours. Until the UPDATEs run, up to 222k forum posts would be formatted incorrectly, but since roughly 187k posts are formatted incorrectly now, maybe that's acceptable.

For an example of the incorrect formatting now, see: http://support.mozilla.com/tiki-view_forum_thread.php?locale=en-US&comments_parentId=256530&forumId=1&s=2.0
(Assignee)

Comment 8

9 years ago
Created attachment 395874 [details]
Script to generate UPDATE queries

This can run on sumotools and will generate the UPDATE statements to run on prod. On my dump from 8/20, it came up with just over 120,000 queries to run, but I think that's a slight underestimate due to the current state of my DB.
Attachment #395676 - Attachment is obsolete: true
Attachment #395874 - Flags: review?(laura)

Comment 9

9 years ago
Thanks James - pulling in justdave who is our database guy.

Dave, how do you feel about James' proposed solution for prod?

Updated

9 years ago
Attachment #395685 - Flags: review?(laura) → review+
(Assignee)

Comment 10

9 years ago
r50343 / r50344

But leaving open until we update the database.

Updated

9 years ago
Target Milestone: 1.3 → 1.4

Updated

9 years ago
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
Target Milestone: 1.4 → 1.3
BTW justdave's comment in IRC was that it would be fine to run on prod as is.
Created attachment 400962 [details] [diff] [review]
updates tiki-view_forum.php

I was finishing up my Ask a question bug when I noticed there's another "Firefox user" instance in tiki-view_forum.php

Seems related to this bug.
Attachment #400962 - Flags: review?(james)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 13

9 years ago
Comment on attachment 400962 [details] [diff] [review]
updates tiki-view_forum.php

I've brought shame on my family. Thanks for catching this one, Paul!
Attachment #400962 - Flags: review?(james) → review+
Comment on attachment 395874 [details]
Script to generate UPDATE queries

this should have been r+ed already since we ran it :)
Attachment #395874 - Flags: review?(laura) → review+
(Assignee)

Comment 15

9 years ago
r52459 / r52460 / r52461
Status: REOPENED → RESOLVED
Last Resolved: 9 years ago9 years ago
Resolution: --- → FIXED
Target Milestone: 1.3 → 1.4
Target Milestone: 1.4 → 1.4.1
Reopening; if I understand comment 1 correctly, " Firefox User" should be "(anon)"; that's not the case on http://support-stage.mozilla.org/en-US/forum/1/446855.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 17

9 years ago
(In reply to comment #16)
> " Firefox User" should be
> "(anon)"; 

No, quite the opposite. "(anon)" in the database is converted to an italicized "Firefox User" in the templates. The issue Paul found was a non-template instance where the old version ("(Firefox User)" in the database, now "(anon)") was still there. It's involved in user watches.
Status: REOPENED → RESOLVED
Last Resolved: 9 years ago9 years ago
Resolution: --- → FIXED
I'm not sure how to test, then; can you give me some pointers?  Is this mostly backend changes?
(Assignee)

Comment 19

9 years ago
I guess the thing to test would be if anonymous user watches are/were working, but I'm not sure. Paul?
What James said sounds good to me. The case I found didn't go into the users table, so there was an inconsistency between the watches and the users tables.

I think a way to test this is to set user watches and receive an email. In the email you get, watch what your name is (I hope it appears). It should NOT have (anon) in it.

Please ping me again, Stephen, if you can't verify this way.
I'm getting "" for anonymous users on watches:

From: notifications@support.mozilla.com
Reply-To: <notifications@support.mozilla.com>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Message-ID: <kqpt2d.majpjq@support-stage.mozilla.org>

"" has posted a reply to a thread you're watching. 
You can view the thread and reply at the following URL: 

https://support-stage.mozilla.org/tiki-view_forum_thread.php?forumId=1&comments_parentId=446879#threadId446881

Is that a separate bug?
(In reply to comment #21)
> Is that a separate bug?
That's odd. There should at least be something. Do we know for certain that this is a regression? Perhaps we can ask others to look through older emails. If it's a regression, it'd be related to this bug, otherwise it would be separate. Either way, it sounds better to just file a separate one.

Let's look at the bright side: At least you're getting the emails :)
Watches are working, and I spun off bug 519573 -- think we're good here.
Status: RESOLVED → VERIFIED
(Assignee)

Updated

8 years ago
Whiteboard: sumo_only
You need to log in before you can comment on or make changes to this bug.