Fix typo on /api/accounts/:id/statuses, fix potential case-sensitivity issue
when registering incoming status mentions, add Travis CI file
This commit is contained in:
		
							parent
							
								
									15476d505d
								
							
						
					
					
						commit
						9a7485d034
					
				
					 5 changed files with 19 additions and 8 deletions
				
			
		
							
								
								
									
										9
									
								
								.travis.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								.travis.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
language: ruby
 | 
			
		||||
cache: bundler
 | 
			
		||||
 | 
			
		||||
rvm:
 | 
			
		||||
  - 2.2.4
 | 
			
		||||
 | 
			
		||||
bundler_args: --without development --retry=3 --jobs=3
 | 
			
		||||
 | 
			
		||||
script: bundle exec rspec
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,8 @@
 | 
			
		|||
Mastodon
 | 
			
		||||
========
 | 
			
		||||
 | 
			
		||||
[](https://travis-ci.org/Gargron/mastodon)
 | 
			
		||||
 | 
			
		||||
Mastodon is a federated microblogging engine. An alternative implementation of the GNU Social project. Based on ActivityStreams, Webfinger, PubsubHubbub and Salmon.
 | 
			
		||||
 | 
			
		||||
**Current status of the project is early development. Documentation &co will be added later**
 | 
			
		||||
| 
						 | 
				
			
			@ -18,12 +20,6 @@ Mastodon is a federated microblogging engine. An alternative implementation of t
 | 
			
		|||
- Upload header image for profile page
 | 
			
		||||
- Deleting statuses, deletion propagation
 | 
			
		||||
 | 
			
		||||
Missing:
 | 
			
		||||
 | 
			
		||||
- Media attachments (photos, videos)
 | 
			
		||||
- Streaming API
 | 
			
		||||
- Blocking users, blocking remote instances
 | 
			
		||||
 | 
			
		||||
## Configuration
 | 
			
		||||
 | 
			
		||||
- `LOCAL_DOMAIN` should be the domain/hostname of your instance. This is **absolutely required** as it is used for generating unique IDs for everything federation-related
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,7 @@ class Api::AccountsController < ApiController
 | 
			
		|||
  end
 | 
			
		||||
 | 
			
		||||
  def statuses
 | 
			
		||||
    @statuses = @account.statuses.with_includes.with_counts.order('created_at desc')
 | 
			
		||||
    @statuses = @account.statuses.with_includes.with_counters.order('created_at desc')
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def follow
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -104,6 +104,12 @@ class Account < ActiveRecord::Base
 | 
			
		|||
    self.where(table[:username].matches(username)).where(domain: nil).take!
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.find_local(username)
 | 
			
		||||
    self.find_local!(username)
 | 
			
		||||
  rescue ActiveRecord::RecordNotFound
 | 
			
		||||
    nil
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  before_create do
 | 
			
		||||
    if local?
 | 
			
		||||
      keypair = OpenSSL::PKey::RSA.new(Rails.env.test? ? 1024 : 2048)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,7 +45,7 @@ class ProcessFeedService < BaseService
 | 
			
		|||
          href = Addressable::URI.parse(mention_link.attribute('href').value)
 | 
			
		||||
 | 
			
		||||
          if href.host == Rails.configuration.x.local_domain
 | 
			
		||||
            mentioned_account = Account.find_by(username: href.path.gsub('/users/', ''), domain: nil)
 | 
			
		||||
            mentioned_account = Account.find_local(href.path.gsub('/users/', ''))
 | 
			
		||||
 | 
			
		||||
            unless mentioned_account.nil?
 | 
			
		||||
              mentioned_account.mentions.first_or_create(status: status)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue