Commit Graph

16 Commits

Author SHA1 Message Date
jdlrobson 878989bd85 Merge PageIssue and IssueSummary type defs
We have two type defs - IssueSummary and PageIssue.
I'd like to consolidate these two types by making
IssueSummary a combination of the two

Change-Id: Ic831b463fa66b0cacdd0b9b79aff741e55c0ec24
2018-10-23 12:10:22 -07:00
Stephen Niedzielski f07985c6de Hygiene: move page issue group parsing to parser
Separate the page issue grouping concern so that changes to parsing
don't concern everything else and vice-versa.

Bug: T203449, T202349
Change-Id: I7bddb0c53310805ece71b8f7821b1d6ce05cfae9
2018-10-16 18:20:38 +00:00
jdlrobson 2f3fed5f4a Users can request new treatment via query string
Bug: T204746
Change-Id: Icea989a401a5de8772fdcd9f25f100899bc1c6f3
2018-09-19 15:21:32 -07:00
Stephen Niedzielski ba17b11987 Hygiene: fix line length violators
Change-Id: Ie1619acf5f319dafc2c9dc612335c1208522dab8
2018-09-13 09:33:20 -06:00
jdlrobson f14d9514c6 Fix `formatPageIssuesSeverity`
The page-issues reducer function that retrieves the severityLevels
for issues was incorrectly comparing two values in the multiple-issues
scenario.

Instead of comparing the severity of the current issue with the previous
value in the accumulator, it was comparing the current issue with the
previous issue in the original array, thus ignoring the
previous `maxSeverity` value in the accumulator.

Tests added and function refactored with more explicit variable names.

Bug: T203725
Change-Id: Ia4c15cbf0c2457d68a7381e8ed04c1a6b3ae65d1
2018-09-07 11:25:16 +02:00
jdlrobson c68f7ba09f Issues instrumentation: issuesClicked events should always send 1 sectionNumber
Erroneously in I6fd55c35b9e2ce35894259f36d1a50fb5dca5e43 for the old treatment
 we sent sectionNumbers for all issues in the page.

This is inconsistent with the issuesSeverity field above it
Add a clarifying inline comment.

Bug: T203050
Change-Id: Ib1fcda0c49a162cd7aca8ee8b3221236f724e1d7
2018-09-06 17:40:34 -07:00
jenkins-bot 993e77e76b Merge "Correct the link for page issues in the old treatment." 2018-09-05 20:14:06 +00:00
jdlrobson dc6f707ea1 Correct the link for page issues in the old treatment.
createBanner was incorrectly always assigning the 'all' keyword
to the old page issues banner. Instead it should use the section
number in the function signature - as this decision of which issues
to show is made inside initPageIssues

For the old treatment, in the main namespace, we only show issues
in the lead section. When we use the 'all' keyword the visual is
the same, but it breaks the instrumentation requirement that
sectionNumbers and issuesSeverity should be the correct length

Note, for the talk and category pages treatment, we do not
log any events so the instrumentation doesn't matter here
and the 'all' keyword correctly targets all issues in the page
as before.

Bug: T203050
Change-Id: I63e45da05ca033fe282633f7fd59038a8e5d8c8d
2018-09-05 12:51:56 -07:00
Timo Tijhof c1fe42fede Hygiene: Use early returns in a few places for special cases
When handling special cases that are logically distinct from
the function's main branch, it improves code quality (through
readability and maintainability) to place those first and with
an early return.

The has the benefit of the main return statement being easy to
find at the end of the function. (Not early and/or in a block).

It also means when working on the code, there is generally a
less complexity and fewer nesting levels, given that most code
is in the main branch. This makes is easier and quicker to verify
that code does what it should, as well as making it easy to
extend in the future. When considering to add code to end of a
function's main scope, it should relate to the function's main
branch by default, not a special case. For example, a getName()
method should not end with a top-level statement 'return false'
(unless it is a stub). Rather, one would expect it to end with
`return name`.

Change-Id: I1f3088f2409c82dd3bf757fc8fa27dc97ae2767b
2018-09-04 21:08:00 +00:00
Jan Drewniak 815f3d99ee For page-issues pageLoaded and editClicked events, treat
"multiple issues" templates as one issue.

When logging the `issuesSeverity` and `sectionNumbers` field,
any issues that are part of a "multiple issues" template only send
one value.

Adds an `isMultiple` property to IssueSummary to determine which
issues are part of a multiple-issues template.

Bug: T203050
Change-Id: I7d55dfead72439df4accadcdc8623a080e1321c2
2018-08-29 13:59:20 -07:00
Jan Drewniak 2cbd57c2f3 Consistent sectionNumbers and issuesSeverity for page-issues.
The value of `sectionNumbers` should be the section number of each issue
Not the number of the sections that have issues.

Bug: T203050
Change-Id: I6fd55c35b9e2ce35894259f36d1a50fb5dca5e43
2018-08-29 13:45:55 -07:00
Jan Drewniak ae19031f8e Log sectionNumbers in PageIssues schema
Adds logging for the sectionNumbers field in the PageIssues schema.

Additional changes:
* createBanner now requires section number to be a string - this ensures
consistency with how these are used.
* fix a bug which meant createBanner was being called with undefined
section number (due to table of contents)
* Fix some indents in some JSDoc blocks
* Change parameter in function signature from mixed type (int or string)
to explicit string
* update schema number

Depends-On: Ia2696b86c6855d7b46a3f668585377d106d7af23
Bug: T202098
Change-Id: I20511a77258ea245f3d6fe93ade238e5df397a71
2018-08-27 18:02:51 +00:00
jdlrobson ee36bcfccf Don't send issuesSeverity given that's an event default
An event only needs to send this field when overriding the
default. This line is thus unnecessary.

Change-Id: Ia1dfcac5dd25f36f5f4169daf6535fd66aedf754
2018-08-27 10:52:55 -07:00
Stephen Niedzielski 73131b7b45 Hygiene: move page issue overlay to distinct file
Move page issue overlay specific code out of cleanuptemplates and into
PageIssueOverlay to clarify what code is specific to the page issues
modal screen and what's specific to the page itself.

Bug: T191528
Change-Id: I95821ccda84306ddd5d22b57ffbae8d13ca44408
2018-08-22 13:42:42 -06:00
jdlrobson eea19f3e18 PageIssues should use new standard pageToken getter
Rather than inventing its own page token the PageIssues
schema will rely on the standard page token.

In future when I9bb18d47e36d2d99d812e5b47ea9516d3dff3a16 is
merged this will mean that PageIssues and ReadingDepth have
consistent page tokens.

Bug: T201124
Change-Id: I19fea41e04cd792423ea9d41a673563418b69726
2018-08-17 10:28:17 -07:00
jdlrobson 40eca4e3f3 Hygiene: IssuesOverlay moved from MobileFrontend to Minerva
The CleanupOverlay is moved to Minerva and renamed the
IssuesOverlay to be consistent with current terminology

The new IssuesOverlay is defined inside the module
skins.minerva.scripts to which it now belongs.

Additional changes:
* various file renames
* overlay-cleanup renames overlay-issues
* cleanuptemplates renamed issues.js
* Add a test stub file to avoid the need to load templates inside
the test environment

After this change, I75f47622d94e504688e04dfb2892540473817053
should be merged to avoid confusion.

Change-Id: I08945a324a6b878abe56efed1e988466085b3018
2018-08-16 14:06:12 -07:00