mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 05:23:17 +00:00
Merge pull request #4428 from pixelfed/staging
Update Status model, increase max mentions, hashtags and links
This commit is contained in:
commit
696804d62e
3 changed files with 10 additions and 9 deletions
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue