leafo / lapis-community

Pluggable message board for Lapis powered websites

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

attempt to call method 'allowed_to_post_topic' (a nil value)

olueiro opened this issue · comments

Hi leafo,

I found an error on Reply older post:

URL: <my-site>/topic/2/new-post

Error
/usr/local/share/lua/5.1/lapis/application.lua:401: ./app.lua:137: attempt to call method 'allowed_to_post_topic' (a nil value)
stack traceback:
	./app.lua: in function 'filter'
	/usr/local/share/lua/5.1/lapis/application.lua:17: in function 'run_before_filter'
	/usr/local/share/lua/5.1/lapis/application.lua:361: in function </usr/local/share/lua/5.1/lapis/application.lua:355>
Traceback
stack traceback:
	[C]: in function 'error'
	/usr/local/share/lua/5.1/lapis/application.lua:401: in function 'handler'
	/usr/local/share/lua/5.1/lapis/application.lua:130: in function 'resolve'
	/usr/local/share/lua/5.1/lapis/application.lua:167: in function </usr/local/share/lua/5.1/lapis/application.lua:165>
	[C]: in function 'xpcall'
	/usr/local/share/lua/5.1/lapis/application.lua:173: in function 'dispatch'
	/usr/local/share/lua/5.1/lapis/nginx.lua:230: in function 'serve'
	content_by_lua(nginx.conf.compiled:30):2: in main chunk

allowed_to_post_topicis not a @topic method.

assert_error @topic\allowed_to_post_topic(@current_user), "not allowed to post"

Can you help me. please :)

commented

Pushed a fix to the example app to address the issue.

Note, I haven't tested the example app in this repo in quite some time, so you may encounter more issues. Feel free to open issues and I can take a closer look

Thank you so much for the speedy reply!