Commit graph

110 commits

Author SHA1 Message Date
Bartosz Dziewoński 0568d42042 Correct typos to fix edit conflict detection
* Query parameters for the API must be in lowercase.
* Also, 'starttimestamp' was misspelled.

Bug: T240643
Change-Id: I6497770dfc3a9512af063b846c3f73aa5603b637
2019-12-13 15:29:42 +01:00
Ed Sanders 763450db24 Create autoSign method and add whitespace trimming.
Method can be used by preview logic later. Whitespace trimming
avoids sig ending up on newline in a <pre>.

Change-Id: If6f06f17395af0c6645082c1b9493be87422c059
2019-12-12 15:28:42 +00:00
Bartosz Dziewoński 3e5a67010f Use module.exports/require() rather than mw.dt namespace for defining classes
The packageFiles system makes it easier to export site config data
from PHP to JS, which we need a lot of, but it's awkward when mixing
it with defining and accessing classes via a namespace like mw.dt.

The only thing remaining in mw.dt is mw.dt.pageThreads, which is
described to be "for debugging", so we should keep it easy to type.
Also we still use the namespace for documenting classes.

Everything else can be reached by require()'ing a ResourceLoader
module, for example instead of `mw.dt.ui.ReplyWidget`
you'd do `require( 'ext.discussionTools.ReplyWidget' )`.
(When debugging from browser console, use `mw.loader.require` instead.)

Change-Id: I6496abcf58c21658d6fd0f3fc1db1f7380a89df7
2019-12-10 22:47:40 +01:00
Bartosz Dziewoński da668b72d5 Identify comments by username+timestamp+seq
Possible use cases:
* Matching comments between PHP and Parsoid HTML [implemented here]
* Finding the same comment in a different revision of a page
  (e.g. while resolving an edit conflict, or to allow resuming
  composition of autosaved comments) [implemented for highlighting
  user's own posted comment only]
* Permanent links to comments [future]

The reasoning for this form of ID is:
* _Timestamp_ by itself is a nearly unique identifier, so it's a good
  thing to start with
* Users may post multiple comments in one edit (or in many edits in
  one minute), so we need the _sequential number_ to distinguish them
* _Username_ is probably not required, but it may reduce the need
  for sequential numbers, and will help with human-readability if we
  add permanent links

The ID remains stable when a new comment is added anywhere by anyone
(excepts comments within the same minute by the same user), or when a
section is renamed.

It's not always stable when a comment is moved or when an entire
section is moved or deleted (archived), but you can't have everything.

Change-Id: Idaae6427d659d12b82e37f1791bd03833632c7c0
2019-12-09 13:45:31 +00:00
Ed Sanders 682732897d i18n all the things
Change-Id: I01da9a88cd69facfeb33b37a727d1cd65c12a78d
2019-12-06 18:51:02 +00:00
jenkins-bot a7db61d43f Merge "Highlight comment after saving" 2019-12-03 16:49:01 +00:00
Ed Sanders a6147ffac8 Highlight comment after saving
* Init on wikipage.content hook
* Update page state variables after save

Change-Id: I05a3c766668999f05cfe06473652429025595196
2019-12-03 16:40:35 +00:00
Bartosz Dziewoński 872c73e1b2 Reserve space for the "Reply" link when hiding it
Otherwise the rest of the page may shift if hiding the link changes
line-wrapping. It felt super confusing when it happened to me while
I was testing an unrelated thing.
https://phabricator.wikimedia.org/F31254175

Change-Id: I53aecdbf3bfba579b48875532d251de0f1c81d6c
2019-11-25 16:23:00 +00:00
Ed Sanders a17fb49a68 Scroll ReplyWidget into view
Change-Id: I302346c85aacf9e410ff1468723b30fd04351032
2019-11-22 16:45:26 -05:00
Ed Sanders 87696c9c3c Move postReply code to controller
Change-Id: Ie66273d9b9f70b625ab7757c93b5884a01c70751
2019-11-21 08:24:57 -05:00