my_forum 0.0.1.beta49 → 0.0.1.beta50

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb039574a705c7c97edc2b0574fa6ee0448eb359
4
- data.tar.gz: d91f264fdfe23508df721faf6547ee3045c5cd1b
3
+ metadata.gz: 01a6adf924404e2aa63c179b0825007047d3d7d1
4
+ data.tar.gz: 95ad8e6116a77456b338ea2d1400d6f57e4adba3
5
5
  SHA512:
6
- metadata.gz: 02de42d1e13362806aa6f53a0674c2d0e4164e38e9c93f99c421c1cc7849dfb81e8f4daaa5d82628c6e741594a3a724e8f30b3c191b2c3500f4d12ba135d14f0
7
- data.tar.gz: d6f538088d56e3f3f4581fdc0f3dfa06e58a5153fa5fbbaac94bc2971dcfc35591b5dc6f52df833babd325ae25454b39595068d35265b9a61a294c6a83f33aba
6
+ metadata.gz: d36dfb8f08717e203a30bc349f388b86265e6df7e7430b7261ea078985e12670486c16d8b2c1f5cee888e69a513e58ad991869855633e173cb8ff6ac22b795c7
7
+ data.tar.gz: 9ca7e53d5ff302c5192cd368878636d99c00ed8cb6c8f0d28e69a3a676da7af4bff1c378cbc00d6d12bb23ed5a612b165d6dd04184e2e832a14ed5e9bc54897f
@@ -24,11 +24,11 @@ module MyForum
24
24
  end
25
25
 
26
26
  def forum_last_message_info(forum)
27
- info = forum.latest_topic_info
27
+ topic = forum.topics.order('latest_post_created_at DESC').first
28
28
 
29
- html = content_tag(:div, info ? (t('.last_answer_from') + info.user_login) : '-' )
30
- html += content_tag(:div, info ? (link_to((t('.in_forum') + info.topic_name), forum_topic_path(info.forum_id, info.id))) : '-' )
31
- html += content_tag(:div, info ? forum_time(info.post_created_at) : '-' )
29
+ html = content_tag(:div, topic ? (t('.last_answer_from') + topic.latest_post_login) : '-' )
30
+ html += content_tag(:div, topic ? (link_to((t('.in_forum') + topic.name), forum_topic_path(topic.forum_id, topic.id))) : '-' )
31
+ html += content_tag(:div, topic ? forum_time(topic.latest_post_created_at) : '-' )
32
32
 
33
33
  html.html_safe
34
34
  end
@@ -4,19 +4,20 @@ module MyForum
4
4
  has_many :topics
5
5
  has_many :posts
6
6
 
7
- def latest_topic_info
8
- Topic.find_by_sql("
9
- SELECT
10
- my_forum_topics.name AS topic_name,
11
- my_forum_topics.forum_id,
12
- my_forum_topics.id,
13
- my_forum_topics.latest_post_created_at AS post_created_at,
14
- my_forum_topics.latest_post_login AS user_login
15
- FROM my_forum_topics
16
- WHERE my_forum_topics.forum_id = #{self.id}
17
- LIMIT 1
18
- ").first
19
- end
7
+ # TODO: Deprecated
8
+ # def latest_topic_info
9
+ # Topic.find_by_sql("
10
+ # SELECT
11
+ # my_forum_topics.name AS topic_name,
12
+ # my_forum_topics.forum_id,
13
+ # my_forum_topics.id,
14
+ # my_forum_topics.latest_post_created_at AS post_created_at,
15
+ # my_forum_topics.latest_post_login AS user_login
16
+ # FROM my_forum_topics
17
+ # WHERE my_forum_topics.forum_id = #{self.id}
18
+ # LIMIT 1
19
+ # ").first
20
+ # end
20
21
 
21
22
  def has_unread_posts?(current_user)
22
23
  latest_post_ids = self.topics.where('updated_at >= ?', current_user.created_at).pluck(:latest_post_id)
@@ -1,3 +1,3 @@
1
1
  module MyForum
2
- VERSION = "0.0.1.beta49"
2
+ VERSION = "0.0.1.beta50"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_forum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta49
4
+ version: 0.0.1.beta50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Omelchenko