Progress
accounts approved, video player testing, bookmark collections
This commit is contained in:
@@ -10,6 +10,7 @@ class Api::V1::AccountsController < Api::BaseController
|
||||
before_action :require_user!, except: [:show, :create]
|
||||
before_action :set_account, except: [:create]
|
||||
before_action :check_account_suspension, only: [:show]
|
||||
before_action :check_enabled_registrations, only: [:create]
|
||||
|
||||
def show
|
||||
render json: @account, serializer: REST::AccountSerializer
|
||||
@@ -75,4 +76,12 @@ class Api::V1::AccountsController < Api::BaseController
|
||||
def account_params
|
||||
params.permit(:username, :email, :password, :agreement, :locale)
|
||||
end
|
||||
|
||||
def check_enabled_registrations
|
||||
forbidden if single_user_mode? || !allowed_registrations?
|
||||
end
|
||||
|
||||
def allowed_registrations?
|
||||
Setting.registrations_mode != 'none'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::BookmarksController < Api::BaseController
|
||||
class Api::V1::BookmarkCollections::BookmarksController < Api::BaseController
|
||||
before_action -> { doorkeeper_authorize! :read, :'read:bookmarks' }
|
||||
before_action :require_user!
|
||||
after_action :insert_pagination_headers
|
||||
|
||||
def index
|
||||
@statuses = []
|
||||
if current_account.is_pro
|
||||
@statuses = load_statuses
|
||||
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
|
||||
else
|
||||
render json: { error: 'You need to be a GabPRO member to access this' }, status: 422
|
||||
end
|
||||
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
|
||||
end
|
||||
|
||||
private
|
||||
@@ -42,11 +43,11 @@ class Api::V1::BookmarksController < Api::BaseController
|
||||
end
|
||||
|
||||
def next_path
|
||||
api_v1_bookmarks_url pagination_params(max_id: pagination_max_id) if records_continue?
|
||||
api_v1_bookmark_collection_bookmarks_url pagination_params(max_id: pagination_max_id) if records_continue?
|
||||
end
|
||||
|
||||
def prev_path
|
||||
api_v1_bookmarks_url pagination_params(since_id: pagination_since_id) unless results.empty?
|
||||
api_v1_bookmark_collection_bookmarks_url pagination_params(since_id: pagination_since_id) unless results.empty?
|
||||
end
|
||||
|
||||
def pagination_max_id
|
||||
@@ -3,24 +3,24 @@
|
||||
class Api::V1::BookmarkCollectionsController < Api::BaseController
|
||||
before_action :require_user!
|
||||
before_action :set_bookmark_collections, only: :index
|
||||
before_action :set_bookmark_collection, only: [:show, :update, :destroy]
|
||||
before_action :set_bookmark_collection, only: [:show, :update, :destroy, :update_status]
|
||||
|
||||
def index
|
||||
render json: @bookmark_collections, each_serializer: REST::BookmarkCollectionSerializer
|
||||
render json: @bookmark_collections, each_serializer: REST::StatusBookmarkCollectionSerializer
|
||||
end
|
||||
|
||||
def create
|
||||
@bookmark_collection = "" #current_account.custom_filters.create!(resource_params)
|
||||
render json: @bookmark_collection, serializer: REST::BookmarkCollectionSerializer
|
||||
@bookmark_collection = current_account.status_bookmark_collections.create!(resource_params)
|
||||
render json: @bookmark_collection, serializer: REST::StatusBookmarkCollectionSerializer
|
||||
end
|
||||
|
||||
def show
|
||||
render json: @bookmark_collection, serializer: REST::BookmarkCollectionSerializer
|
||||
render json: @bookmark_collection, serializer: REST::StatusBookmarkCollectionSerializer
|
||||
end
|
||||
|
||||
def update
|
||||
@bookmark_collection.update!(resource_params)
|
||||
render json: @bookmark_collection, serializer: REST::BookmarkCollectionSerializer
|
||||
render json: @bookmark_collection, serializer: REST::StatusBookmarkCollectionSerializer
|
||||
end
|
||||
|
||||
def destroy
|
||||
@@ -28,14 +28,18 @@ class Api::V1::BookmarkCollectionsController < Api::BaseController
|
||||
render_empty_success
|
||||
end
|
||||
|
||||
def update_status
|
||||
#
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_bookmark_collections
|
||||
@bookmark_collections = "" #current_account.custom_filters
|
||||
@bookmark_collections = current_account.status_bookmark_collections
|
||||
end
|
||||
|
||||
def set_bookmark_collection
|
||||
@bookmark_collection = "" # current_account.custom_filters.find(params[:id])
|
||||
@bookmark_collection = current_account.status_bookmark_collections.find(params[:id])
|
||||
end
|
||||
|
||||
def resource_params
|
||||
|
||||
Reference in New Issue
Block a user