Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature-webpack
- Loading branch information
Showing
29 changed files
with
273 additions
and
45 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 |
---|---|---|
|
@@ -88,3 +88,4 @@ AllCops: | |
- 'Rakefile' | ||
- 'node_modules/**/*' | ||
- 'Vagrantfile' | ||
- 'vendor/**/*' |
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
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,30 @@ | ||
# frozen_string_literal: true | ||
|
||
module UserTrackingConcern | ||
extend ActiveSupport::Concern | ||
|
||
REGENERATE_FEED_DAYS = 14 | ||
UPDATE_SIGN_IN_HOURS = 24 | ||
|
||
included do | ||
before_action :set_user_activity, if: %i(user_signed_in? user_needs_sign_in_update?) | ||
end | ||
|
||
private | ||
|
||
def set_user_activity | ||
# Mark as signed-in today | ||
current_user.update_tracked_fields!(request) | ||
|
||
# Regenerate feed if needed | ||
RegenerationWorker.perform_async(current_user.account_id) if user_needs_feed_update? | ||
end | ||
|
||
def user_needs_sign_in_update? | ||
current_user.current_sign_in_at.nil? || current_user.current_sign_in_at < UPDATE_SIGN_IN_HOURS.hours.ago | ||
end | ||
|
||
def user_needs_feed_update? | ||
current_user.last_sign_in_at < REGENERATE_FEED_DAYS.days.ago | ||
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
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
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,19 @@ | ||
class CreateBlockMutes < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table "block_mutes", force: :casecade do |t| | ||
t.integer "account_id", null: false | ||
t.integer "target_account_id", null: false | ||
t.boolean "block", null: false | ||
t.datetime "created_at", null: false | ||
t.datetime "updated_at", null: false | ||
end | ||
|
||
add_column :blocks, :block, :boolean, null: false | ||
execute "ALTER TABLE blocks ADD CONSTRAINT check_mutes_on_block CHECK(block = TRUE), INHERIT block_mutes" | ||
Block.update_all block: true | ||
|
||
add_column :mutes, :block, :boolean, null: false | ||
execute "ALTER TABLE mutes ADD CONSTRAINT check_mutes_on_block CHECK(block = FALSE), INHERIT block_mutes" | ||
Mute.update_all block: false | ||
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ def minor | |
end | ||
|
||
def patch | ||
1 | ||
2 | ||
end | ||
|
||
def pre | ||
|
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 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Admin::ConfirmationsController, type: :controller do | ||
render_views | ||
|
||
before do | ||
sign_in Fabricate(:user, admin: true), scope: :user | ||
end | ||
|
||
describe 'POST #create' do | ||
it 'confirms the user' do | ||
account = Fabricate(:account) | ||
user = Fabricate(:user, confirmed_at: false, account: account) | ||
post :create, params: { account_id: account.id } | ||
|
||
expect(response).to redirect_to(admin_accounts_path) | ||
expect(user.reload).to be_confirmed | ||
end | ||
|
||
it 'raises an error when there is no account' do | ||
post :create, params: { account_id: 'fake' } | ||
|
||
expect(response).to have_http_status(:missing) | ||
end | ||
|
||
it 'raises an error when there is no user' do | ||
account = Fabricate(:account, user: nil) | ||
post :create, params: { account_id: account.id } | ||
|
||
expect(response).to have_http_status(:missing) | ||
end | ||
end | ||
end |
Oops, something went wrong.