Commit graph

233 commits

Author SHA1 Message Date
Oneric
c7d7fd5fdd rich_content: overhaul spacing around mentions
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_metadata/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
The old code was inconsistent about when the mention line state and
remembered spacing were reset as well as failing to add necessary
whitespace if a mention line was immediately succeeded by a plain text node.
The latter was kludgily fixd for a particular special case with the
last-child exception to whitespace trimming. (However this could en up
to retaining superfluous undesireable space in other cases)

This led to sometimes space being added "back" several times
notably leading to one extra, empty line in blockquote elements
succeeding mentions with whitespace. This stalled the otherwise
unrelated #412

Now we always reset the mention chain and remembered spacing together
and also add back spacing in front of plain text nodes if appropriate
obsoleting the last-child exception.
2026-04-14 00:00:00 +00:00
Oneric
f3907fe0be unittest/rich_content: fix MFM injection tests
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
Just like the old NIH HTML parser this test wrongfully assumed
">" couldn't appear unescaped in tag attributes and thus was
broken for many months now after a browser upgrade in our CI runners
caused this to be quoted automatically anyway.

Instead test against actual injection attempts
of additional styling rules and new attributes.
2026-04-13 00:00:00 +00:00
Oneric
87ef8eeaf1 Replace awful and buggy inhouse HTML parser
The inhouse parser wrongly assumed tag attributes could not contain
literal '>' characters, has issues like the recently fixed
#480 and probably many
more problems. In any event the regex and characterwise parser mess was
hard to read and reason about.

Browsers already have optimised HTML parsers built in so use it.
Also rework the nested function into a parser class for even better
readability.
Other than using a proper HTML AST and rearranging everything into
a class this for the most part closely follows the previous logic.
More substantial logic changes were made to emoji processing and
green/cyantext styling.
The former now processes text in chunks to the next colon rather
than character by character. The latter is possibly a bit more
leient in what it styles now and no longer will break styling
tags enclosing a <br />.
2026-04-13 00:00:00 +00:00
Oneric
c98962f4b3 user*: expose profile media alt texts
Only avatar alt text is integrated into the UI in an assistive way.
Header and backgrounds are set as CSS backgrounds and I don’t know
of a good way to add alt or aria-label attributes to that. Nor whether
it even makes sense to bake this into the default view since their just
decorative background elements.
The full al text can still be accessed through the new profile media gallery.

Despite many places setting distinct :title and :alt atttributes
for StillImage, it actually only had a :alt attribute used for both.
This is however not what we want here,
so add (back?) :title as a distinct property.

Related backend change: AkkomaGang/akkoma#1034
2026-04-04 00:00:00 +00:00
Oneric
0f695386fe list: expose exclusive parameter
Allows excluding list members from home timeline.
Matches Mastodon and implemented in Akkoma via
AkkomaGang/akkoma#1062
2026-03-28 00:00:00 +00:00
Oneric
7fb67ee723 service/file_type: fallback to generic Masto type
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
E.g. bridgy doesn’t federate the full MIME type and
it’s attachment URLs also have no extension. Thus
the full MIME type is always just a generic binary,
but since it still federates a more specific AP type
the generic Mastodon type still contains some information
we can use here to display it properly.

While at it, drop unused fileMatchesSomeType function.
Its last users disappeared in e654fead23.

Ref.: https://github.com/snarfed/bridgy-fed/issues/2198

Co-authored-by: Yonle <yonle@proton.me>
2026-03-27 00:00:00 +00:00
Oneric
efe15c98c6 lists: ensure all properties exist after creation
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This used to cause null errors e.g. when initialising the accounts for a
newly created list, which also prevented a post-creation redirect to the
new list’s page from occuring.

Co-authored-by: Yonle <yonle@proton.me>

Fixes: #367
Fixes: #368
2026-03-15 00:00:00 +00:00
ilja
25681cf5f6 Don't require # in the data-mfm-color attribute
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
For colour in MFM attributes, we expected a `#`, but that's apparently wrong. The BE
translates the `color` attribute in `$[fg.color=000 text]` into `data-mfm-color=000`.
But for the SCSS to work, we need to put it in the style attribute as `--mfm-color: #000`.

Generally we just add the attribute value as-is in the `style` attribute, but now we
have a special exception for color so we add a `#` before the value.
2024-08-18 15:48:22 +02:00
ilja
6666a273a4 MFM only use sanitised data-* attribute values
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
We take the value from a data-* attribute and then add this to the style attribute.
This will probably be OK in most cases, but just to be sure, we check for "weird" characters first.
For now we only allow letters, numbers, dot, hash, and plus and minus sign, because those are the ones I currently know of who are used in MFM.
The data-* attribute remains because it was already considered proper HTML as-is.
2024-08-11 18:11:03 +02:00
0baf31f498 correct package.json lint task
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2024-05-29 04:01:29 +01:00
a7dea2f70f ANNOYING dependency update 2024-05-28 04:02:17 +01:00
db46879a8f Big 'ol set of patches and dep maintenance (#212)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
Reviewed-on: AkkomaGang/pleroma-fe#212
2022-11-15 15:47:32 +00:00
75024d8501 re-add time direction (#52)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: AkkomaGang/pleroma-fe#52
2022-07-21 20:56:30 +00:00
a8c4aec721 purge shout/chat (#49)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: AkkomaGang/pleroma-fe#49
2022-07-20 15:36:45 +00:00
fab72940c4 announcements (#42)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: AkkomaGang/pleroma-fe#42
2022-07-18 13:08:50 +00:00
Sol Fisher Romanoff
ba4656312a
Add tests 2022-06-19 00:04:53 +03:00
Sol Fisher Romanoff
cea08d41ee
Add tests to #3
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
2022-06-17 20:40:49 +03:00
a0305e90f0 fix tests and add CI (#5)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
Reviewed-on: http://akkoma.dev/AkkomaGang/pleroma-fe/pulls/5
2022-06-15 17:22:02 +00:00
f6cf509a04 Merge remote-tracking branch 'upstream/develop' into develop 2022-06-08 18:09:16 +01:00
Henry Jameson
0bb69d7fe0 fix tests 2022-04-12 19:04:32 +03:00
Henry Jameson
dc8bef7928 remove compat build 2022-03-29 00:58:17 +03:00
Henry Jameson
3250e59266 fix routes test 2022-03-22 18:56:54 +02:00
Henry Jameson
e5ae0671ce skip user profile test for now https://github.com/vuejs/test-utils/issues/1382 2022-03-22 18:56:39 +02:00
Henry Jameson
9d7a7e2019 fix emoji input tests 2022-03-22 18:22:23 +02:00
Henry Jameson
c2cf13fc00 fix richcontent and its tests 2022-03-22 18:22:23 +02:00
Henry Jameson
c3546ea856 fix tests running 2022-03-22 18:22:23 +02:00
HJ
58d0f9678b Merge branch 'fix-mentions-new-bugs' into 'develop'
Fix newfound bugs with rich mentions + user suggestions

See merge request pleroma/pleroma-fe!1430
2022-02-20 15:11:52 +00:00
Henry Jameson
5864dc52f7 removed file because that logic has been removed 2022-02-20 00:43:38 +02:00
Henry Jameson
86e3aefdab new unit tests 2022-02-19 23:04:51 +02:00
Henry Jameson
a8d1987686 fix unit tests 2022-02-19 22:40:19 +02:00
1bc05e87e4 apply patches 2022-01-28 19:07:28 +00:00
Henry Jameson
39494439d3 very minimalist hashtaglink implementation, also you can middle-click
mentions now.
2021-08-23 20:57:21 +03:00
Henry Jameson
c3576211cb fix tests 2021-08-18 21:17:51 +03:00
Henry Jameson
8cc1ad67df fix links sticking to mentionsline 2021-08-15 18:11:38 +03:00
Henry Jameson
7d67e8f1cc remove obsolete tests 2021-08-15 02:44:36 +03:00
Henry Jameson
97e86381c8 remove old emoji added, everything emoji-bearing uses RichContent now 2021-08-13 13:12:33 +03:00
Henry Jameson
add5921b8b fix tests, add performance test (skipped, doesn't assert anything),
tweak max mentions count
2021-08-12 19:37:04 +03:00
Henry Jameson
2cfff1b8b9 remove new options for style and separate line, now groups all chained
mentions on a mentionsline regardless of placement. fixes spacing
2021-08-12 02:56:40 +03:00
Henry Jameson
a0eaac2216 fix tests 2021-06-22 21:09:29 +03:00
Henry Jameson
c6831a3810 fix not escaping some stuff 2021-06-18 21:42:46 +03:00
Henry Jameson
8fe4355a6b fix rich images 2021-06-18 21:29:47 +03:00
Henry Jameson
25bf28f051 added tests just in case 2021-06-16 02:11:24 +03:00
Henry Jameson
ad3a2fd4e5 fixed "invisible" spans inside links 2021-06-16 01:20:20 +03:00
Henry Jameson
4aac0125e5 fixed bug with hashtags 2021-06-15 14:43:44 +03:00
Henry Jameson
7309f8ce1a lint 2021-06-14 10:31:07 +03:00
Henry Jameson
c21b1cf898 do the impossible, fix the unfixable 2021-06-14 10:30:08 +03:00
Henry Jameson
636dbdaba8 more fixes 2021-06-13 22:22:59 +03:00
Henry Jameson
bebafa1a2c refactored line converter, untied its logic from greentexting, better
handling of broken cases
2021-06-13 15:24:29 +03:00
Henry Jameson
9c70f3e4df fixed a bug + made a testcase out of it 2021-06-12 21:49:56 +03:00
Henry Jameson
18fb7516cc lint 2021-06-12 20:44:14 +03:00