Merge branch 'next-minor' into develop
This commit is contained in:
commit
09aef2f145
4 changed files with 37 additions and 3 deletions
|
|
@ -25,6 +25,7 @@
|
||||||
* Deleted comments will be removed when loading more comments [#7045](https://github.com/diaspora/diaspora/pull/7045)
|
* Deleted comments will be removed when loading more comments [#7045](https://github.com/diaspora/diaspora/pull/7045)
|
||||||
* The "subscribe" indicator on a post now gets toggled when you like or rehsare a post [#7040](https://github.com/diaspora/diaspora/pull/7040)
|
* The "subscribe" indicator on a post now gets toggled when you like or rehsare a post [#7040](https://github.com/diaspora/diaspora/pull/7040)
|
||||||
* Add OpenGraph video support [#7043](https://github.com/diaspora/diaspora/pull/7043)
|
* Add OpenGraph video support [#7043](https://github.com/diaspora/diaspora/pull/7043)
|
||||||
|
* You'll now get redirected to the invites page if you follow an invitation but you're already logged in [#7061](https://github.com/diaspora/diaspora/pull/7061)
|
||||||
|
|
||||||
# 0.6.0.0
|
# 0.6.0.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,14 @@ class InvitationCodesController < ApplicationController
|
||||||
redirect_to root_url, :notice => I18n.t('invitation_codes.not_valid')
|
redirect_to root_url, :notice => I18n.t('invitation_codes.not_valid')
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
sign_out(current_user) if user_signed_in?
|
if user_signed_in?
|
||||||
redirect_to new_user_registration_path(:invite => {:token => params[:id]})
|
invite = InvitationCode.find_by_token!(params[:id])
|
||||||
|
flash[:notice] = I18n.t("invitation_codes.already_logged_in", inviter: invite.user.name)
|
||||||
|
redirect_to person_path(invite.user.person)
|
||||||
|
else
|
||||||
|
redirect_to new_user_registration_path(invite: {token: params[:id]})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -553,6 +553,7 @@ en:
|
||||||
|
|
||||||
invitation_codes:
|
invitation_codes:
|
||||||
not_valid: "That invite code is no longer valid"
|
not_valid: "That invite code is no longer valid"
|
||||||
|
already_logged_in: "You have been invited by %{inviter} to join this pod but you are already logged in."
|
||||||
|
|
||||||
invitations:
|
invitations:
|
||||||
create:
|
create:
|
||||||
|
|
|
||||||
27
spec/controllers/invitation_codes_controller_spec.rb
Normal file
27
spec/controllers/invitation_codes_controller_spec.rb
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
require "spec_helper"
|
||||||
|
|
||||||
|
describe InvitationCodesController, type: :controller do
|
||||||
|
describe "#show" do
|
||||||
|
it "redirects to the root page if the invitation code is invalid" do
|
||||||
|
get :show, id: "InvalidInvitationCode"
|
||||||
|
expect(response).to redirect_to root_path
|
||||||
|
expect(flash[:notice]).to eq(I18n.t("invitation_codes.not_valid"))
|
||||||
|
end
|
||||||
|
|
||||||
|
context "valid invitation code" do
|
||||||
|
let(:invitation_token) { alice.invitation_code.token }
|
||||||
|
|
||||||
|
it "redirects logged out users to the sign in page" do
|
||||||
|
post :show, id: invitation_token
|
||||||
|
expect(response).to redirect_to new_user_registration_path(invite: {token: invitation_token})
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects logged in users the the inviters page" do
|
||||||
|
sign_in bob
|
||||||
|
post :show, id: invitation_token
|
||||||
|
expect(response).to redirect_to person_path(alice.person)
|
||||||
|
expect(flash[:notice]).to eq(I18n.t("invitation_codes.already_logged_in", inviter: alice.name))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue