diff --git a/apps/threads.lua b/apps/threads.lua index cec5d81..78050f1 100644 --- a/apps/threads.lua +++ b/apps/threads.lua @@ -23,6 +23,7 @@ app:get("thread_create", "/create", function(self) end self.all_topics = all_topics self.page_title = "creating thread" + self.me = user return {render = "threads.create"} end) @@ -90,7 +91,7 @@ app:get("thread", "/:slug", function(self) LIMIT ? OFFSET ? ]], thread.id, POSTS_PER_PAGE, (self.page - 1) * POSTS_PER_PAGE) self.topic = Topics:find(thread.topic_id) - self.user = util.get_logged_in_user_or_transient(self) + self.me = util.get_logged_in_user_or_transient(self) self.posts = posts self.page_title = thread.title diff --git a/apps/topics.lua b/apps/topics.lua index 9292394..73cfaf9 100644 --- a/apps/topics.lua +++ b/apps/topics.lua @@ -21,7 +21,7 @@ local ThreadCreateError = { app:get("all_topics", "", function(self) self.topic_list = db.query("select * from topics limit 25;") - self.user = util.get_logged_in_user(self) or util.TransientUser + self.me = util.get_logged_in_user_or_transient(self) return {render = "topics.topics"} end) @@ -32,6 +32,7 @@ app:get("topic_create", "/create", function(self) end self.page_title = "creating topic" + self.me = user return {render = "topics.create"} end) @@ -67,7 +68,7 @@ app:get("topic", "/:slug", function(self) self.threads_list = db.query("SELECT * FROM threads WHERE topic_id = ? ORDER BY is_stickied DESC, created_at DESC", topic.id) local user = util.get_logged_in_user_or_transient(self) print(topic.is_locked, type(topic.is_locked)) - self.user = user + self.me = user self.ThreadCreateError = ThreadCreateError self.thread_create_error = ThreadCreateError.OK if user:is_logged_in_guest() then @@ -95,7 +96,7 @@ app:get("topic_edit", "/:slug/edit", function(self) return {redirect_to = self:url_for("all_topics")} end self.topic = topic - + self.me = user self.page_title = "editing topic " .. topic.name return {render = "topics.edit"} diff --git a/apps/users.lua b/apps/users.lua index f5a443b..6f2c52b 100644 --- a/apps/users.lua +++ b/apps/users.lua @@ -131,8 +131,7 @@ app:get("user_delete_confirm", "/:username/delete_confirm", function(self) self.err = self.session.flash.error self.session.flash = {} end - self.user = target_user - + self.me = target_user self.page_title = "confirm deletion" return {render = "user.delete_confirm"} @@ -212,8 +211,7 @@ app:get("user_settings", "/:username/settings", function(self) self.flash_msg = flash.error end end - self.user = target_user - + self.me = target_user self.page_title = "settings" return {render = "user.settings"} @@ -440,4 +438,4 @@ app:post("guest_user", "/guest_user/:user_id", function(self) return {redirect_to = self:url_for("user", {username = target_user.username})} end) -return app \ No newline at end of file +return app diff --git a/views/common/topnav.etlua b/views/common/topnav.etlua index 9f5cf85..82100e9 100644 --- a/views/common/topnav.etlua +++ b/views/common/topnav.etlua @@ -4,8 +4,8 @@ ">All topics - <% if user:is_logged_in() then -%> - Welcome, "><%= user.username %> + <% if me:is_logged_in() then -%> + Welcome, "><%= me.username %> <% else -%> Welcome, guest. Please ">log in <% end -%> diff --git a/views/threads/thread.etlua b/views/threads/thread.etlua index 1bbc5f1..3269ceb 100644 --- a/views/threads/thread.etlua +++ b/views/threads/thread.etlua @@ -1,4 +1,4 @@ -<% render("views.common.topnav", {user = user}) -%> +<% render("views.common.topnav") -%>
-<% if not user:is_guest() then %> +<% if not me:is_guest() then %>

Respond to "<%= thread.title %>"


diff --git a/views/topics/topic.etlua b/views/topics/topic.etlua index f242ccf..f1c6e78 100644 --- a/views/topics/topic.etlua +++ b/views/topics/topic.etlua @@ -22,7 +22,7 @@

This topic is locked.

<% end %> -<% if user:is_mod() then %> +<% if me:is_mod() then %>
">Edit topic "> diff --git a/views/topics/topics.etlua b/views/topics/topics.etlua index f0c5323..998e890 100644 --- a/views/topics/topics.etlua +++ b/views/topics/topics.etlua @@ -11,6 +11,6 @@ <% end %> <% end %> -<% if user:is_mod() then %> +<% if me:is_mod() then %> ">Create new topic <% end %> diff --git a/views/user/delete_confirm.etlua b/views/user/delete_confirm.etlua index dc183ef..81ea20a 100644 --- a/views/user/delete_confirm.etlua +++ b/views/user/delete_confirm.etlua @@ -1,4 +1,4 @@ -

Are you sure you want to delete your account, <%= user.username %>?

+

Are you sure you want to delete your account, <%= me.username %>?

This cannot be undone. This will not delete your posts, only anonymize them.

If you are sure, please type your password below.

@@ -6,7 +6,7 @@

<%= err %>

<% end %> -"> +">
diff --git a/views/user/settings.etlua b/views/user/settings.etlua index f893f11..7f9a661 100644 --- a/views/user/settings.etlua +++ b/views/user/settings.etlua @@ -2,19 +2,19 @@ <% if flash_msg then %>

<%= flash_msg %>

<% end %> -
" enctype="multipart/form-data"> -
+" enctype="multipart/form-data"> +
-<% if not user:is_default_avatar() then %> - "> +<% if not me:is_default_avatar() then %> + "> <% end %>
-
+

-">Delete account +">Delete account