Add GET /api/v1/accounts/:id/statuses/media that returns only statuses with media attachments
Make replies default to privacy settings of the status being replied to
This commit is contained in:
		
							parent
							
								
									d0f087db2d
								
							
						
					
					
						commit
						8132cf8153
					
				| 
						 | 
					@ -126,6 +126,8 @@ export default function compose(state = initialState, action) {
 | 
				
			||||||
    return state.withMutations(map => {
 | 
					    return state.withMutations(map => {
 | 
				
			||||||
      map.set('in_reply_to', action.status.get('id'));
 | 
					      map.set('in_reply_to', action.status.get('id'));
 | 
				
			||||||
      map.set('text', statusToTextMentions(state, action.status));
 | 
					      map.set('text', statusToTextMentions(state, action.status));
 | 
				
			||||||
 | 
					      map.set('unlisted', action.status.get('visibility') === 'unlisted');
 | 
				
			||||||
 | 
					      map.set('private', action.status.get('visibility') === 'private');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  case COMPOSE_REPLY_CANCEL:
 | 
					  case COMPOSE_REPLY_CANCEL:
 | 
				
			||||||
    return state.withMutations(map => {
 | 
					    return state.withMutations(map => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,6 +58,21 @@ class Api::V1::AccountsController < ApiController
 | 
				
			||||||
    set_pagination_headers(next_path, prev_path)
 | 
					    set_pagination_headers(next_path, prev_path)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def media_statuses
 | 
				
			||||||
 | 
					    media_ids = MediaAttachment.where(account: @account).where.not(status_id: nil).reorder('').select('distinct status_id')
 | 
				
			||||||
 | 
					    @statuses = @account.statuses.where(id: media_ids).permitted_for(@account, current_account).paginate_by_max_id(limit_param(DEFAULT_STATUSES_LIMIT), params[:max_id], params[:since_id])
 | 
				
			||||||
 | 
					    @statuses = cache_collection(@statuses, Status)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set_maps(@statuses)
 | 
				
			||||||
 | 
					    set_counters_maps(@statuses)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    next_path = media_statuses_api_v1_account_url(max_id: @statuses.last.id)    if @statuses.size == limit_param(DEFAULT_STATUSES_LIMIT)
 | 
				
			||||||
 | 
					    prev_path = media_statuses_api_v1_account_url(since_id: @statuses.first.id) unless @statuses.empty?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    set_pagination_headers(next_path, prev_path)
 | 
				
			||||||
 | 
					    render action: :statuses
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def follow
 | 
					  def follow
 | 
				
			||||||
    FollowService.new.call(current_user.account, @account.acct)
 | 
					    FollowService.new.call(current_user.account, @account.acct)
 | 
				
			||||||
    set_relationship
 | 
					    set_relationship
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -151,6 +151,7 @@ Rails.application.routes.draw do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        member do
 | 
					        member do
 | 
				
			||||||
          get :statuses
 | 
					          get :statuses
 | 
				
			||||||
 | 
					          get 'statuses/media', to: 'accounts#media_statuses', as: :media_statuses
 | 
				
			||||||
          get :followers
 | 
					          get :followers
 | 
				
			||||||
          get :following
 | 
					          get :following
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue