mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-22 05:08:03 +00:00
Remove orphaned notifications, add scopes param to app create API
This commit is contained in:
parent
954f344cf7
commit
e8c27767aa
|
@ -4,6 +4,6 @@ class Api::V1::AppsController < ApiController
|
|||
respond_to :json
|
||||
|
||||
def create
|
||||
@app = Doorkeeper::Application.create!(name: params[:client_name], redirect_uri: params[:redirect_uris])
|
||||
@app = Doorkeeper::Application.create!(name: params[:client_name], redirect_uri: params[:redirect_uris], scopes: params[:scopes])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,6 +31,7 @@ class Account < ApplicationRecord
|
|||
has_many :statuses, inverse_of: :account, dependent: :destroy
|
||||
has_many :favourites, inverse_of: :account, dependent: :destroy
|
||||
has_many :mentions, inverse_of: :account, dependent: :destroy
|
||||
has_many :notifications, inverse_of: :account, dependent: :destroy
|
||||
|
||||
# Follow relations
|
||||
has_many :active_relationships, class_name: 'Follow', foreign_key: 'account_id', dependent: :destroy
|
||||
|
|
|
@ -7,6 +7,8 @@ class Favourite < ApplicationRecord
|
|||
belongs_to :account, inverse_of: :favourites
|
||||
belongs_to :status, inverse_of: :favourites, touch: true
|
||||
|
||||
has_one :notification, as: :activity, dependent: :destroy
|
||||
|
||||
validates :status_id, uniqueness: { scope: :account_id }
|
||||
|
||||
def verb
|
||||
|
|
|
@ -7,6 +7,8 @@ class Follow < ApplicationRecord
|
|||
belongs_to :account
|
||||
belongs_to :target_account, class_name: 'Account'
|
||||
|
||||
has_one :notification, as: :activity, dependent: :destroy
|
||||
|
||||
validates :account, :target_account, presence: true
|
||||
validates :account_id, uniqueness: { scope: :target_account_id }
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ class Mention < ApplicationRecord
|
|||
belongs_to :account, inverse_of: :mentions
|
||||
belongs_to :status
|
||||
|
||||
has_one :notification, as: :activity, dependent: :destroy
|
||||
|
||||
validates :account, :status, presence: true
|
||||
validates :account, uniqueness: { scope: :status }
|
||||
end
|
||||
|
|
|
@ -16,6 +16,8 @@ class Status < ApplicationRecord
|
|||
has_many :media_attachments, dependent: :destroy
|
||||
has_and_belongs_to_many :tags
|
||||
|
||||
has_one :notification, as: :activity, dependent: :destroy
|
||||
|
||||
validates :account, presence: true
|
||||
validates :uri, uniqueness: true, unless: 'local?'
|
||||
validates :text, presence: true, length: { maximum: 500 }, if: proc { |s| s.local? && !s.reblog? }
|
||||
|
|
Loading…
Reference in a new issue