From 1430f5328f54003637edb16c72366f42774ceaee Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 27 May 2023 07:23:20 -0600 Subject: [PATCH 1/3] Update Status model, increase max mentions, hashtags and links --- app/Status.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Status.php b/app/Status.php index 4148a4f99..77262597e 100644 --- a/app/Status.php +++ b/app/Status.php @@ -50,11 +50,11 @@ class Status extends Model 'loop' ]; - const MAX_MENTIONS = 5; + const MAX_MENTIONS = 20; - const MAX_HASHTAGS = 30; + const MAX_HASHTAGS = 60; - const MAX_LINKS = 2; + const MAX_LINKS = 5; public function profile() { From ac9fb5f661c204025346b4baa5106ac57baf5dfb Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 27 May 2023 07:24:08 -0600 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecd60dd5e..686129f6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Update StatusActivityPubDeliver, fix delivery addressing ([1f2183ee](https://github.com/pixelfed/pixelfed/commit/1f2183ee)) - Update UpdateStatusService, fix formatting issue. Fixes #4423 ([4479055e](https://github.com/pixelfed/pixelfed/commit/4479055e)) - Update nginx config ([ee3b6e09](https://github.com/pixelfed/pixelfed/commit/ee3b6e09)) +- Update Status model, increase max mentions, hashtags and links ([1430f532](https://github.com/pixelfed/pixelfed/commit/1430f532)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.7 (2023-05-24)](https://github.com/pixelfed/pixelfed/compare/v0.11.6...v0.11.7) From d4f92da0e59d28218c28e50c485b34b58bdf15be Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 27 May 2023 07:27:35 -0600 Subject: [PATCH 3/3] Fix test --- tests/Unit/Lexer/StatusLexerTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Unit/Lexer/StatusLexerTest.php b/tests/Unit/Lexer/StatusLexerTest.php index caaedd8ed..f1b19a4c5 100644 --- a/tests/Unit/Lexer/StatusLexerTest.php +++ b/tests/Unit/Lexer/StatusLexerTest.php @@ -109,31 +109,31 @@ class StatusLexerTest extends TestCase /** @test * */ public function mentionLimit() { - $text = '@test1 @test @test2 @test3 @test4 @test5 test post'; + $text = '@test1 @test @test2 @test3 @test4 @test5 @test6 @test7 @test8 @test9 @test10 @test11 @test12 @test13 @test14 @test15 @test16 @test17 @test18 @test19 test post'; $entities = Extractor::create()->extract($text); $count = count($entities['mentions']); - $this->assertEquals($count, Status::MAX_MENTIONS); + $this->assertEquals(Status::MAX_MENTIONS, $count); } /** @test * */ public function hashtagLimit() { - $text = '#hashtag0 #hashtag1 #hashtag2 #hashtag3 #hashtag4 #hashtag5 #hashtag6 #hashtag7 #hashtag8 #hashtag9 #hashtag10 #hashtag11 #hashtag12 #hashtag13 #hashtag14 #hashtag15 #hashtag16 #hashtag17 #hashtag18 #hashtag19 #hashtag20 #hashtag21 #hashtag22 #hashtag23 #hashtag24 #hashtag25 #hashtag26 #hashtag27 #hashtag28 #hashtag29 #hashtag30 #hashtag31'; + $text = '#hashtag0 #hashtag1 #hashtag2 #hashtag3 #hashtag4 #hashtag5 #hashtag6 #hashtag7 #hashtag8 #hashtag9 #hashtag10 #hashtag11 #hashtag12 #hashtag13 #hashtag14 #hashtag15 #hashtag16 #hashtag17 #hashtag18 #hashtag19 #hashtag20 #hashtag21 #hashtag22 #hashtag23 #hashtag24 #hashtag25 #hashtag26 #hashtag27 #hashtag28 #hashtag29 #hashtag30 #hashtag31 #hashtag0 #hashtag1 #hashtag2 #hashtag3 #hashtag4 #hashtag5 #hashtag6 #hashtag7 #hashtag8 #hashtag9 #hashtag10 #hashtag11 #hashtag12 #hashtag13 #hashtag14 #hashtag15 #hashtag16 #hashtag17 #hashtag18 #hashtag19 #hashtag20 #hashtag21 #hashtag22 #hashtag23 #hashtag24 #hashtag25 #hashtag26 #hashtag27 #hashtag28 #hashtag29 #hashtag30 #hashtag31'; $entities = Extractor::create()->extract($text); $count = count($entities['hashtags']); - $this->assertEquals($count, Status::MAX_HASHTAGS); + $this->assertEquals(Status::MAX_HASHTAGS, $count); } /** @test * */ public function linkLimit() { - $text = 'https://example.org https://example.net https://example.com'; + $text = 'https://example.org https://example.net https://example.com https://example.com https://example.net'; $entities = Extractor::create()->extract($text); $count = count($entities['urls']); - $this->assertEquals($count, Status::MAX_LINKS); + $this->assertEquals(Status::MAX_LINKS, $count); } }