xforum 0.0.379 → 0.0.381

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: 0adcc543103cd2ecc60621a2a9562d60a17f3679
4
- data.tar.gz: d5c9997eb2f6fbbdeee66601090624d2f175bc82
3
+ metadata.gz: 16d11219db1b75ff631adc09c42f09a6cf1c4cf7
4
+ data.tar.gz: 28207bcf3dc34899a741edb41fd70f0f01541675
5
5
  SHA512:
6
- metadata.gz: 51501c9774888f987bd8e8ca140d4d5890532b3c72eaaae26e3af917d49987bbd96683b98c59463ac0c68bcd0ab278bbbb82f686de9540cce6f98e2f9b7379a5
7
- data.tar.gz: 0a3cce0442be303763cf4c64df3e66d913a8c4c4c6a9528cee5c8585958648eb7dc150846cbb670068a4059fa1682671cfd02c6714782a7f8c50dce11f860b5a
6
+ metadata.gz: 5049d0f28b790c30ad084a6e99c1ee9094cce9270f64b40d15ff987684b211c2067c9b73012dce45d15b53ca806bd24b44b125b01f148a06023ec0ce40efd528
7
+ data.tar.gz: c2be7d2c4b3dae53dc1b8814d395858b5b06f60fa007a358d8547b689519a4a565bab10dab0a3ef153fc4bc18507512fadfe717bc54743ac294d061d3a99ef4f
@@ -45,14 +45,14 @@ module Xforum
45
45
  if params[:topic]== 'select topic'
46
46
  return
47
47
  end
48
- topic=Topic.where(name:params[:topic]).pluck(:id)[0]
49
- category=Category.find_by(topic_id:topic.id)
48
+ topic=Topic.find_by(name:params[:topic])
49
+ category=Category.find_by(id:topic.category_id)
50
50
  if (category.private || !user.forum_admin?) && PeopleList.check_invitation(category.name,category.id, user.id, 'category')
51
51
  {to_do:'nothing'}
52
52
  elsif (topic.restricted && !user.forum_admin?) && PeopleList.check_invitation(topic.name,topic.id, user.id, 'topic')
53
53
  {to_do:'nothing'}
54
54
  else
55
- index=Forum.clear_user_topic(user.id,topic_id)
55
+ index=Forum.clear_user_topic(user.id,topic.id)
56
56
  the_list=[]
57
57
  plucking= [:id, :parent, :content, :user_id,:owner_name,:state,:restricted,:tag,:has_photo]
58
58
  plucking_names= [:id, :parent, :content,:owner,:owner_name,:comment_state,:restricted,:tag,:has_photo,:needs_translation,:empty_list] #we're going to append empty list to the reply
@@ -106,10 +106,9 @@ module Xforum
106
106
  {list_data: ForumAssist.named_array(alist, [:value, :item]), name: params[:list]}
107
107
  end
108
108
 
109
- def self.check_restrictions(alist, user, list_type)
110
- blist=[]
111
- byebug
112
- alist.each { |record|
109
+ def self.check_restrictions(blist, user, list_type)
110
+ alist=blist.clone #so you can do list.each and delete items
111
+ blist.each { |record|
113
112
  skip=false
114
113
  case list_type
115
114
  when 'topic'
@@ -119,14 +118,15 @@ module Xforum
119
118
  end
120
119
  if !category.nil? && category.restricted
121
120
  if PeopleList.check_invitation(record[:name],category.id, user.id, 'category')
121
+ alist.delete(record)
122
122
  skip=true
123
123
  end
124
124
  end
125
125
  unless skip
126
- blist.push(record) unless record[:restricted] && PeopleList.check_invitation(record[:name],record[:id], user.id, list_type)
126
+ alist.delete(record) if record[:restricted] && PeopleList.check_invitation(record[:name],record[:id], user.id, list_type)
127
127
  end
128
128
  }
129
- blist
129
+ alist
130
130
  end
131
131
 
132
132
  def self.check_invitation(name,id,user_id,list_type)
@@ -1,3 +1,3 @@
1
1
  module Xforum
2
- VERSION = '0.0.379'
2
+ VERSION = '0.0.381'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xforum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.379
4
+ version: 0.0.381
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert D Blanton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-28 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3