Commit graph

4 commits

Author SHA1 Message Date
Gergő Tisza b00eca6ade Collect license handling code, remove unused data attribute
This just shuffles code around, should not change behavior.

Change-Id: Ieb0102300c8444f18444fae38e5ea813d8f682e5
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/472
2014-04-19 00:39:21 +00:00
Gergő Tisza b9b1529e9b Add more information to embed HTML
Adds site link, license link and long name, replaces internal license name
(we don't have it for most licenses) with short name.

Also fixes some problems in previous changesets that I stumbled on,
renames things to be more consistent/less misleading, and makes
EmbedFileInfo a thin container for existing classes. (That results
in a lot of Demeter's law violations, but it means one less model
to remember, which is a good thing since our property names are
often not very informative (e.g. EmbedFileInfo.url and
Image.url which had completely different meanings))

We always have the site information for embed texts (comes from the repo
API); that part of the tests was pointless, but now that EmbedFileInfo
depends on Repo they became impossible to maintain, hence the
deletion of half the test cases in getThumbnailHtml().

Change-Id: I94e1d0aca14e2a7d5fad983412090add8ad6bfa3
Mingle:  https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/369
2014-03-27 19:14:06 +00:00
Gergő Tisza d85e7bf32e Utilities to transform HTML to plain or filtered text
This takes care of several minor annoyances:
* centralizes all the text processing functions which have been
  floating all around the code, and adds proper tests
* filters out invisible elements (sometimes used for metadata)
* avoids merging separate words on HTML->text transformation
* adds caching since doing all this transformations could be
  processing-intensive for big chunks of HTML. (This might or
  might not be a good idea. I haven't done performance tests, so
  this might be premature optimization, and increases memory use.
  OTOH these functions are often called in situations where an
  immediate UI response is expected (such as selecting a size
  from the list) so even small delays would be perceivable.

Bug: 63126
Change-Id: I1ef1e3a33efdfea17612df00da6b629bf39e07aa
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/388
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/369
2014-03-27 19:11:09 +00:00
Gergő Tisza c1ff536c3c Get more license info
Fetch more license information from the imageinfo API
(as needed by the reuse panel), store it in a new model

Change-Id: I331598b55b86d13e23a8bcd58c3ad8fcab749e6f
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/369
2014-03-20 23:07:02 +00:00