Fix timeline double requests due to templates
This one is a bit embarrassing..
This commit is contained in:
		
							parent
							
								
									5d561eacf1
								
							
						
					
					
						commit
						1bd48ea8ca
					
				| 
						 | 
				
			
			@ -7,10 +7,11 @@ import ".."/[query, types, api, agents]
 | 
			
		|||
import ../views/general
 | 
			
		||||
 | 
			
		||||
template respResolved*(url, kind: string): untyped =
 | 
			
		||||
  if url.len == 0:
 | 
			
		||||
  let u = url
 | 
			
		||||
  if u.len == 0:
 | 
			
		||||
    resp showError("Invalid $1 link" % kind, cfg)
 | 
			
		||||
  else:
 | 
			
		||||
    redirect(url)
 | 
			
		||||
    redirect(u)
 | 
			
		||||
 | 
			
		||||
proc createResolverRouter*(cfg: Config) =
 | 
			
		||||
  router resolver:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,9 +78,10 @@ proc showTimeline*(request: Request; query: Query; cfg: Config; prefs: Prefs;
 | 
			
		|||
                    rss=rss, images = @[p.getUserpic("_200x200")])
 | 
			
		||||
 | 
			
		||||
template respTimeline*(timeline: typed) =
 | 
			
		||||
  if timeline.len == 0:
 | 
			
		||||
  let t = timeline
 | 
			
		||||
  if t.len == 0:
 | 
			
		||||
    resp Http404, showError("User \"" & @"name" & "\" not found", cfg)
 | 
			
		||||
  resp timeline
 | 
			
		||||
  resp t
 | 
			
		||||
 | 
			
		||||
proc createTimelineRouter*(cfg: Config) =
 | 
			
		||||
  setProfileCacheTime(cfg.profileCacheTime)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue