Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit e5cf72e

Browse files
committed
fixed merge conflict related to bump to ruby 2.3.4
2 parents 69e86c7 + b2861e4 commit e5cf72e

34 files changed

+342
-86
lines changed

.ruby-version

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
2.3.1
1+
2+
2.3.4
3+

DOCKER.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# Running Klaxon with Docker
22

3-
*This guide is a work in progress.*
3+
## Development Quickstart
4+
5+
1. Run the following commands:
6+
7+
```
8+
docker-compose up -d database
9+
docker-compose build app
10+
docker-compose run app rake db:create db:migrate
11+
docker-compose run app rake users:create_admin
12+
docker-compose up app
13+
open http://localhost:3000
14+
```
15+
16+
2. Enter 'admin@news.org' in the email window. It should redirect you to a page that says: "Email Sent".
17+
18+
3. In the console find where it says "Go to Dashboard ( ... )" and copy and paste the link into the browser.
19+
20+
4. You'll now be logged in. The page should say "Watch Your First Item".
421

522
## Expected environmental variables
623

@@ -20,10 +37,10 @@ If you would like to use [Amazon SES](https://aws.amazon.com/ses/) instead to se
2037
DATABASE_URL=
2138
SECRET_KEY_BASE=
2239
ADMIN_EMAILS=
23-
SMTP_PROVIDER=AMAZON_SES
24-
AMAZON_SES_ADDRESS=
25-
AMAZON_SES_USERNAME=
26-
AMAZON_SES_PASSWORD=
27-
AMAZON_SES_DOMAIN=
28-
EMAIL_FROM_ADDRESS=
40+
SMTP_PROVIDER=SES
41+
SES_ADDRESS=
42+
SES_USERNAME=
43+
SES_PASSWORD=
44+
SES_DOMAIN=
45+
MAILER_FROM_ADDRESS=
2946
```

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM ruby:2.3.1
1+
2+
FROM ruby:2.3.4
3+
24

35
# throw errors if Gemfile has been modified since Gemfile.lock
46
RUN bundle config --global frozen 1
@@ -19,9 +21,6 @@ RUN bundle install
1921

2022
COPY . /usr/src/app
2123

22-
ENV RACK_ENV "production"
23-
ENV RAILS_ENV "production"
24-
2524
EXPOSE 3000
2625
ENTRYPOINT ["kubernetes-secret-env"]
2726
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
source 'https://rubygems.org'
2-
ruby '~> 2.3.0'
2+
3+
ruby '2.3.4'
34

45
gem 'rails', '4.2.5.1'
56
gem 'pg', '~> 0.15'

Gemfile.lock

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ DEPENDENCIES
309309
webmock
310310

311311
RUBY VERSION
312-
ruby 2.3.2p217
312+
313+
ruby 2.3.4p301
314+
313315

314316
BUNDLED WITH
315-
1.13.6
317+
1.14.6

NEWSROOMS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# News organizations using Klaxon
2+
3+
* Associated Press
4+
* Austin American-Statesman
5+
* Axios
6+
* Dallas Morning News
7+
* FiveThirtyEight
8+
* Fusion
9+
* Gizmodo
10+
* KBIA, in Columbia, Mo.
11+
* The Marshall Project
12+
* NBC Los Angeles
13+
* The New York Times
14+
* Omaha World-Herald
15+
* ProPublica
16+
* Reveal from the Center for Investigative Reporting
17+
* SBS News, Australia
18+
* Seattle Times
19+
* Texas Tribune
20+
* Verdens Gang AS in Oslo, Norway
21+
* Vermont Public Radio
22+
* Washington Post
23+
24+
If you know of others who are finding Klaxon useful, please let us know with an email to klaxon-reports[at]themarshallproject[dot]org

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Read more below, or say hello to the humans behind the project at the [Google Gr
1212

1313
## Alerting journalists to changes on the web
1414

15-
Built and refined in the newsroom of [The Marshall Project](https://www.themarshallproject.org/), Klaxon has provided our journalists with many news tips, giving us early warnings and valuable time to pursue stories. Klaxon has been used and tested by journalists at The Marshall Project, The New York Times, the Texas Tribune, the Associated Press and elsewhere. The public release of this free and open source software was supported by Knight-Mozilla [OpenNews](https://opennews.org/). [If you need help using Klaxon once it's already been set up, [you can find it here.](https://github.com/themarshallproject/klaxon/blob/master/data/help.md)]
15+
Built and refined in the newsroom of [The Marshall Project](https://www.themarshallproject.org/), Klaxon has provided our journalists with many news tips, giving us early warnings and valuable time to pursue stories. Klaxon has been used and tested by journalists at The Marshall Project, The New York Times, the Texas Tribune, the Associated Press [and elsewhere](NEWSROOMS.md). The public release of this free and open source software was supported by Knight-Mozilla [OpenNews](https://opennews.org/). [If you need help using Klaxon once it's already been set up, [you can find it here.](https://github.com/themarshallproject/klaxon/blob/master/data/help.md)]
1616

1717
[![Circle CI](https://circleci.com/gh/themarshallproject/klaxon.svg?style=svg)](https://circleci.com/gh/themarshallproject/klaxon)
1818

@@ -74,6 +74,10 @@ Once you’re logged in, you should see the main page that will fill up in the c
7474

7575
On the right side of the page, click the “Create New User” button. Add the reporter’s first and last name and email address, and she will get an email allowing her into the Klaxon. Now, finally, you and your users can start adding web pages you want Klaxon to watch.
7676

77+
#### Limit new users to only those on specific email domain(s)
78+
79+
By default, people with any email address can be added as new users. If you'd like to allow only users with *specific* email domains, set the `APPROVED_USER_DOMAINS` environment variable (or "Config Variable" in Heroku's lingo). That variable should be a comma-separated list of domains, e.g., `themarshallproject.org,nsa.gov`.
80+
7781
### Notify a Slack channel
7882

7983
You’re all set for email notifications. If you’d like to also receive alerts through Slack, you can set that up now too. (If you want alerts from other services, [we welcome pull requests](CONTRIBUTING.md)) Click on the “Settings” button in the upper right corner of the page and choose “Integrations” from the menu. On the Integrations page, click the “Create Slack Integration” button. You can add an integration for any number of channels in your newsroom’s Slack. For each one, you just have to set up an Incoming Webhook. In Slack, click on the dropdown arrow in the upper left corner and choose “Apps & Integrations” from the menu. This will open a new window in your browser for you to search the Slack app directory. In the search box, type “Incoming Webhooks” and choose that option when it pops up. If you already have webhooks, you’ll see a button next to your Slack organization’s name that says “Configure.” Otherwise, click the green button that says “Install”.
@@ -111,12 +115,14 @@ The core contributors to Klaxon have been Ivar Vong, Andy Rossback, Tom Meagher
111115

112116
We've been grateful for additional contributions to the project from:
113117

114-
* Ryan Murphy
115-
* Jeremy Merrill
118+
* Jackson Gothe-Snape, SBS News
116119
* Emily Hopkins
117-
* Ari Shapell
118120
* Yolanda Martinez
119-
* Jackson Gothe-Snape, SBS News
121+
* Jeremy Merrill
122+
* Ryan Murphy
123+
* Justin Myers
124+
* Ari Shapell
125+
* Jeremy Singer-Vine
120126
* Mike Stucka
121127
* Bob Weston
122128

app/assets/stylesheets/static.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ a {
1212
border-bottom: 2px solid #ff0b3a;
1313
}
1414

15-
a:hover, a:focus {
15+
a:not(.btn):hover, a:focus {
1616
color: #ff0b3a;
1717
text-decoration: none;
1818
border-bottom: 2px solid #ff0b3a;
@@ -86,6 +86,10 @@ table tbody tr td:last-child, table thead tr td:last-child {
8686
color: #ff0b3a;
8787
}
8888

89+
.form-check-box {
90+
margin-bottom: 10px !important;
91+
}
92+
8993
.btn {
9094
border-radius: 0 !important;
9195
border: 1px solid #ff0b3a;

app/controllers/sessions_controller.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def new
55
end
66

77
def create
8-
user = User.find_by(email: params[:email])
8+
user = User.find_by("LOWER(email) = ?", params[:email].downcase)
99
if user.nil?
1010
redirect_to unknown_user_path and return false
1111
end
@@ -17,14 +17,24 @@ def create
1717

1818
def token
1919
user = LoginToken.decode(token: params[:token])
20-
2120
if user.present?
22-
cookies.signed[:user_id] = { value: user.id, expires: 7.days.from_now, httponly: true }
23-
redirect_to root_path
21+
if user[:expired]
22+
redirect_to expired_token_path(user[:user].id)
23+
else
24+
cookies.signed[:user_id] = { value: user.id, expires: 7.days.from_now, httponly: true }
25+
redirect_to root_path
26+
end
2427
else
2528
redirect_to unknown_user_path
2629
end
2730
end
31+
32+
def unknown_user
33+
end
34+
35+
def expired_token
36+
@user = User.find(params[:user_id].to_i)
37+
end
2838

2939
def destroy
3040
cookies.delete(:user_id)

app/controllers/static_controller.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
class StaticController < ApplicationController
2-
before_filter :authorize, except: [:unknown_user]
32

43
def help
54
path = File.join(Rails.root, 'data', 'help.md')
65
markdown = File.read(path)
76
@html = Kramdown::Document.new(markdown).to_html
87
end
98

10-
def unknown_user
11-
end
12-
139
def feed
1410
end
1511

0 commit comments

Comments
 (0)