mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-23 23:54:07 +01:00
Tweak the context_listing/edit_then_delete test to run more reliably
More adjustments to the time zone calculations. Fixes #450 Add context and project finders as Association Extensions on the User model to simplify controllers and address the feed bug identified by Ryan. Fixes #446 and #444 Replaced usages of "uncompleted" with "incomplete" git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@454 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
0a28edb2d8
commit
139051f55f
15 changed files with 70 additions and 62 deletions
|
|
@ -116,21 +116,9 @@ class ContextsController < ApplicationController
|
|||
end
|
||||
|
||||
def check_user_set_context
|
||||
if params['url_friendly_name']
|
||||
@context = @user.contexts.find_by_url_friendly_name(params['url_friendly_name'])
|
||||
elsif params['id'] && params['id'] =~ /^\d+$/
|
||||
@context = @user.contexts.find(params['id'])
|
||||
elsif params['id']
|
||||
@context = @user.contexts.find_by_url_friendly_name(params['id'])
|
||||
else
|
||||
redirect_to :action => 'index'
|
||||
end
|
||||
if @context && @user == @context.user
|
||||
return @context
|
||||
else
|
||||
@context = nil # Should be nil anyway.
|
||||
notify :warning, "Item and session user mis-match: #{@context.user_id} and #{@user.id}!"
|
||||
render :text => ''
|
||||
@context = @user.contexts.find_by_params(params)
|
||||
if @context.nil?
|
||||
render :text => "Context not found.", :status => 404
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue