Commit graph

30 commits

Author SHA1 Message Date
Reedy 7619a76877 Namespace Echo Formatters
Change-Id: I5bf398cdb76a577543f6526ac1bee4a73897103d
2022-11-01 21:20:06 -06:00
Reedy bd062137bb formatters: Minor cleanup
* Fix some indenting
* Remove some unnecessary temporary variables

Change-Id: I2330238a090b7f5ccd14d8e44aeaff10d731352e
2022-11-01 15:39:23 -06:00
Bartosz Dziewoński f66c4283e9 Allow overriding section title presentation in subclasses
Change-Id: Idb3a87fd18330f90a8cdc1276994d54288e17b28
2022-01-20 23:50:47 +01:00
vladshapik aac1986c3b Clean up Title deprecated methods
Replace hard deprecated getPreviousRevisionID method with RevisionLookup::getPreviousRevision method

Bug: T274151
Change-Id: Ia6ec1a4765ba5849b53919a6e9d73df7e839f6ed
2021-02-18 14:45:20 +02:00
Stephane Bisson 1ebb8e3daa Don't add CommentStoreComment as plaintext params
Follow-up Icfc8516 and I3d997f9 (migrating from deprecated Revision
to RevisionRecord)

When generating 'edit-user-talk' events, if we don't have the section-text,
we use the edit summary instead.

Revision->getComment() returns a string but RevisionRecord->getComment()
returns a CommentStoreComment. As a result of the migration, an instance
of CommentStoreComment was put into the event 'extra_data' and later
added as a plain text params during notification presentation.

This patch proposes to
1) Make sure to add the comment's TEXT to the event
2) Test that the 'section-text' is a string before using it
   as a message parameter. This will cause faulty notifications to
   render without a body instead of erroring out. We could write a
   maintenance script to fix those notifications but I don't
   think it's worth it.

Bug: T223741
Change-Id: Ie3a1c59a43b0981ec42fc77e7ebb0e8bd132dbe2
2019-05-21 11:44:54 -04:00
Roan Kattouw 9832d2af8b Don't use {$this->type} in message keys where not needed
It makes the code less clear and makes message keys harder to grep for.

Change-Id: I0641e7cd0b8262d8b6548a06d505e19c1b5a1fb0
2019-04-05 17:33:28 -07:00
Stephane Bisson 754338fe48 Convert PresentationModelSection from trait to class
This trait was using private fields from its host classes
($this->event, $this->language). It created a weird coupling
situation where the host class uses the trait and the trait
uses the host class. Effectively a circular dependency.

Also, phan is complaining about it in
I65ae6adc10941c05a2646e551b1baa829e4e8654

Change-Id: Ib2796b7ca62ecd7ece19583d7ca83e4252a5d878
2019-04-05 16:57:48 -04:00
Matěj Suchánek b7f189ca5a Make edit-user-talk notifications expandable
Bug: T162299
Change-Id: I79a5e52dc8b861bd0ed4a55ce5d80c5a97cddb70
2017-10-20 11:27:47 +02:00
James D. Forrester 8c810dff48 build: Update mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I25cb61b3b92798f1259d1575a336e2b056d5764f
2016-12-05 15:54:30 -08:00
Roan Kattouw 6eea6d93a1 Used parsed section titles for anchors
This allows us to link to the right section when the section
title contains templates or magic words.

* Add getParsedSectionTitle()
* Use it in getTitleWithSection()
** Stop using Parser::guessSectionNameFromWikiText() because it
   wants preprocessed wikitext, not fully parsed and stripped text
* Move getTruncatedSectionTitle() from EventPresentationModel to
  PresentationModelSectionTrait and make it use getParsedSectionTitle()

Bug: T134216
Change-Id: I877ff6b0ce4e64400f6e5f6284ae47a11cd4335b
2016-09-27 16:17:59 -07:00
jenkins-bot 5a2faf26da Merge "HTML email formatter using presentation model" 2016-05-14 00:29:30 +00:00
Roan Kattouw d2f899d9d3 Handle section-text being null
This was causing warnings in production:
Invalid parameter for message "notification-body-edit-user-talk-with-section": a:1:{s:9:"plaintext";N;}

Change-Id: Ibdea5d899caf446a8c7f811416fdabaa3dccccdd
2016-05-13 16:39:59 -07:00
Stephane Bisson 6f6e10084c HTML email formatter using presentation model
Bug: T121067
Change-Id: I77f466f0b507ffa49a9714ddba95bea8db1d8438
2016-05-12 09:29:24 -04:00
Roan Kattouw 33124f35a8 Move section methods into a trait
Change-Id: Ief2005918b92945ff93aea85d17e595c7c38adf2
2016-04-28 20:52:09 +00:00
Roan Kattouw c5361da55a Clean up section title handling in mention and edit-user-talk presentation models
They were using different code and different approaches.
I've left getSection() and the code for creating a Title
with a section duplicated for now, and I'll move them
into a trait in the next commit. I wanted to do that
separately because we aren't using traits in this
code base yet.

Change-Id: I56cf745d2cc8a6c43caec08024187de9598cecb8
2016-04-21 18:31:12 -07:00
Roan Kattouw b91360131c Use plaintextParams() for snippets and sections
We ended up double-parsing section titles, which resulted
in strange behavior when the section title was something like
{{tl|infobox}}.

Bug: T132872
Change-Id: I4434624f392cd0e1df39374d45d60f7d83be7161
2016-04-19 16:02:26 +00:00
Matthew Flaschen cac85b635f Make plural support for large values (100 or more) explicit in l10n
This involves:

* Making this value no longer admin-configurable.
* Changing getNotificationCountForOutput to return only a single value
  Since there is no + in the formatted value anymore, we can actually
  use the same value for both.

  This is a B/C break, but hopefully worth it to simplify the method
  call.

  For now, the excess parameter is just marked unused.  It could be
  removed at some point if the translations are updated.

This must be merged at the same time as:
* Flow - Ibfa56b1af9e8c56b4c5f900e0d487bc09688b2a2
* MobileFrontend - Ibf784b279d56773a227ff261b75f2b26125bbb63 (well, MF
  can be merged first)
* translatewiki - I2a4b6938aed49e4101deb6b9351c43656a863490

Also, change 1 to One/one, per Siebrand on the task.  This can easily
be dropped/undone if we don't want it.

Also, remove reference to no-longer-existent notification-page-linked-bundle

Bug: T127288
Change-Id: Iabeaae747f99980c0610d552f6b38f89d940b890
2016-03-16 18:43:16 -04:00
Moriel Schottlender 9a1defa57f Bidi isolate content items in notification header text
Bug: T127407
Change-Id: I25c426f3d0190bd33c4aa1c2ffb3c97fe1424567
2016-03-09 16:22:52 -08:00
Matthias Mullie 4715b55471 Add GENDER support to 'View changes'
Change-Id: I42b8b253b8b865c081ba1aec62848afadd21e0f4
2016-02-23 17:56:16 +01:00
Stephane Bisson 779b7030d9 Truncate usernames, titles and excerpts in notifications
Bug: T121822
Change-Id: Ia0a52926133ab7e04d7d9c2a095ef8f9d0871a49
2016-01-29 07:04:23 -05:00
Stephane Bisson 9e536c91d4 Rephrase Echo 'edit-user-talk' notification
Bug: T123934
Change-Id: If053f9787127ca4488c51a663000a48bc717cadf
2016-01-18 15:44:18 -05:00
jenkins-bot 18bffba313 Merge "Display revert edit summary in revert notification body" 2016-01-18 19:46:49 +00:00
Stephane Bisson d7d70a06a1 Display revert edit summary in revert notification body
Only display when it's different than the pre-populated
edit summary (Undo revision 123 by User).

Bug: T121808
Change-Id: I5a00ff174fd31fdbf776a06b7b9375f63b921677
2016-01-18 10:14:15 -05:00
Roan Kattouw c345bef598 Add icon to "View changes" secondary links
Bug: T121736
Change-Id: I7dda877c26c99392c17702265380f4ea2a6e8049
2016-01-14 22:53:51 -08:00
Justin Du 7d2a15d3bc Clarify some notification icons
* edit-user-talk
* mention
* user-rights
* emailuser

Bug: T121735
Change-Id: I72e382b9ff9d19c6acc0df507fdff65732b66450
2016-01-13 14:00:37 -08:00
jenkins-bot a29c62065c Merge "Add agent link to most notifications" 2016-01-11 22:46:41 +00:00
Stephane Bisson 421ba29a2f Add agent link to most notifications
Affected notifications are
  - edit-user-talk
  - email-user
  - mention
  - reverted
  - user-rights

Bug: T121737
Change-Id: I826cc6088b4f9c1aaef9e8adee0566d25982ed47
2016-01-11 14:34:39 -08:00
Kunal Mehta 7f0dafbe73 Don't parse wikitext in edit-user-talk snippets
Bug: T121994
Change-Id: I427def99f2773896feabaf6202e7f4eecd850be1
2016-01-08 09:22:20 -08:00
Matthias Mullie 3f65ed519f Use current (with keys) array format for primary & secondary links
They're currently auto-converted to the new format, but ideally,
we wouldn't need that B/C code. And since this is the extension
others will likely look at for examples when implementing, we
should do it right here.

Also: there is no B/C correction for missing keys in secondary
links (description, icon).

Change-Id: If1a8b9911e81bb4c565f21a4b9e31fdc73426d93
2015-12-16 17:52:04 +01:00
Stephane Bisson 04d4da2783 Presentation model for edit-user-talk
Bug: T116843
Change-Id: Ia11f5b57747ed0be5d4b00c75925d5fcdde87c43
2015-12-09 13:35:10 -05:00