-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
355 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ | |
/log/* | ||
!/log/.keep | ||
/tmp | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--color | ||
--require spec_helper | ||
--format Fuubar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Mention < ActiveRecord::Base | ||
belongs_to :account, inverse_of: :mentions | ||
belongs_to :status, inverse_of: :mentions | ||
|
||
validates :account, :status, presence: true | ||
validates :account, uniqueness: { scope: :status } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class ProcessMentionsService < BaseService | ||
# Scan status for mentions and fetch remote mentioned users, create | ||
# local mention pointers, send Salmon notifications to mentioned | ||
# remote users | ||
# @param [Status] status | ||
def call(status) | ||
status.text.scan(Account::MENTION_RE).each do |match| | ||
username, domain = match.first.split('@') | ||
local_account = Account.find_by(username: username, domain: domain) | ||
|
||
if local_account.nil? | ||
local_account = follow_remote_account_service.("acct:#{match.first}") | ||
end | ||
|
||
local_account.mentions.first_or_create(status: status) | ||
end | ||
|
||
status.mentions.each do |mentioned_account| | ||
next if mentioned_account.local? | ||
send_interaction_service.(status.stream_entry, mentioned_account) | ||
end | ||
end | ||
|
||
private | ||
|
||
def follow_remote_account_service | ||
@follow_remote_account_service ||= FollowRemoteAccountService.new | ||
end | ||
|
||
def send_interaction_service | ||
@send_interaction_service ||= SendInteractionService.new | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class CreateMentions < ActiveRecord::Migration | ||
def change | ||
create_table :mentions do |t| | ||
t.integer :account_id | ||
t.integer :status_id | ||
|
||
t.timestamps null: false | ||
end | ||
|
||
add_index :mentions, [:account_id, :status_id], unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe AtomController, type: :controller do | ||
describe 'GET #user_stream' do | ||
pending | ||
end | ||
|
||
describe 'GET #entry' do | ||
pending | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe HomeController, type: :controller do | ||
|
||
describe 'GET #index' do | ||
pending | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe ProfileController, type: :controller do | ||
|
||
describe "GET #show" do | ||
it "returns http success" do | ||
get :show | ||
expect(response).to have_http_status(:success) | ||
end | ||
describe 'GET #show' do | ||
pending | ||
end | ||
|
||
describe 'GET #entry' do | ||
pending | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe XrdController, type: :controller do | ||
describe 'GET #host_meta' do | ||
pending | ||
end | ||
|
||
describe 'GET #webfinger' do | ||
pending | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'rails_helper' | ||
|
||
# Specs in this file have access to a helper object that includes | ||
# the RoutingHelper. For example: | ||
# | ||
# describe RoutingHelper do | ||
# describe "string concat" do | ||
# it "concats two strings with spaces" do | ||
# expect(helper.concat_strings("this","that")).to eq("this that") | ||
# end | ||
# end | ||
# end | ||
RSpec.describe RoutingHelper, type: :helper do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,47 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Account, type: :model do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
describe '#follow!' do | ||
pending | ||
end | ||
|
||
describe '#unfollow!' do | ||
pending | ||
end | ||
|
||
describe '#following?' do | ||
pending | ||
end | ||
|
||
describe '#local?' do | ||
pending | ||
end | ||
|
||
describe '#acct' do | ||
pending | ||
end | ||
|
||
describe '#subscribed?' do | ||
pending | ||
end | ||
|
||
describe '#keypair' do | ||
pending | ||
end | ||
|
||
describe '#subscription' do | ||
pending | ||
end | ||
|
||
describe '#object_type' do | ||
pending | ||
end | ||
|
||
describe '#title' do | ||
pending | ||
end | ||
|
||
describe '#content' do | ||
pending | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,31 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Favourite, type: :model do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
describe '#verb' do | ||
pending | ||
end | ||
|
||
describe '#title' do | ||
pending | ||
end | ||
|
||
describe '#content' do | ||
pending | ||
end | ||
|
||
describe '#object_type' do | ||
pending | ||
end | ||
|
||
describe '#target' do | ||
pending | ||
end | ||
|
||
describe '#mentions' do | ||
pending | ||
end | ||
|
||
describe '#thread' do | ||
pending | ||
end | ||
end |
Oops, something went wrong.