mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 00:12:25 -05:00 
			
		
		
		
	Link hashtag bug (#121)
* link + hashtag bug * remove printlns * tidy up some duplicated code
This commit is contained in:
		
					parent
					
						
							
								ea8ad8b346
							
						
					
				
			
			
				commit
				
					
						a940a520d3
					
				
			
		
					 15 changed files with 349 additions and 97 deletions
				
			
		|  | @ -37,17 +37,22 @@ func (suite *StatusTestSuite) TestDeriveMentionsOK() { | |||
| 
 | ||||
| 	@someone_else@testing.best-horse.com can you confirm? @hello@test.lgbt | ||||
| 
 | ||||
| 	@thisisalocaluser ! @NORWILL@THIS.one!! | ||||
| 	@thisisalocaluser! | ||||
| 
 | ||||
| 	here is a duplicate mention: @hello@test.lgbt @hello@test.lgbt | ||||
| 
 | ||||
| 	@account1@whatever.com @account2@whatever.com | ||||
| 
 | ||||
| 	here is a duplicate mention: @hello@test.lgbt | ||||
| 	` | ||||
| 
 | ||||
| 	menchies := util.DeriveMentionsFromStatus(statusText) | ||||
| 	assert.Len(suite.T(), menchies, 4) | ||||
| 	assert.Len(suite.T(), menchies, 6) | ||||
| 	assert.Equal(suite.T(), "@dumpsterqueer@example.org", menchies[0]) | ||||
| 	assert.Equal(suite.T(), "@someone_else@testing.best-horse.com", menchies[1]) | ||||
| 	assert.Equal(suite.T(), "@hello@test.lgbt", menchies[2]) | ||||
| 	assert.Equal(suite.T(), "@thisisalocaluser", menchies[3]) | ||||
| 	assert.Equal(suite.T(), "@account1@whatever.com", menchies[4]) | ||||
| 	assert.Equal(suite.T(), "@account2@whatever.com", menchies[5]) | ||||
| } | ||||
| 
 | ||||
| func (suite *StatusTestSuite) TestDeriveMentionsEmpty() { | ||||
|  | @ -57,12 +62,14 @@ func (suite *StatusTestSuite) TestDeriveMentionsEmpty() { | |||
| } | ||||
| 
 | ||||
| func (suite *StatusTestSuite) TestDeriveHashtagsOK() { | ||||
| 	statusText := `#testing123 #also testing | ||||
| 	statusText := `weeeeeeee #testing123 #also testing | ||||
| 
 | ||||
| # testing this one shouldn't work | ||||
| 
 | ||||
| 			#thisshouldwork | ||||
| 
 | ||||
| 	here's a link with a fragment: https://example.org/whatever#ahhh | ||||
| 
 | ||||
| #ThisShouldAlsoWork #not_this_though | ||||
| 
 | ||||
| #111111 thisalsoshouldn'twork#### ##` | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue