whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: rough in action
Date Sat, 06 Aug 2016 15:54:22 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  f8c6435   rough in action
f8c6435 is described below

commit f8c6435afb75bc10c6f8f906b9c77c5b8a6cd724
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Sat Aug 6 11:54:06 2016 -0400

    rough in action
---
 lib/whimsy/asf/ldap.rb       |  2 +-
 www/roster/views/group.js.rb | 50 +++++++++++++++++++++++++++-----------------
 2 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index ed87740..dc2ed00 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -801,7 +801,7 @@ module ASF
 
     def remove(people)
       @members = nil
-      people = Array(people & members).map(&:dn)
+      people = (Array(people) & members).map(&:dn)
       ASF::LDAP.modify(self.dn, [ASF::Base.mod_delete('member', people)])
     ensure
       @members = nil
diff --git a/www/roster/views/group.js.rb b/www/roster/views/group.js.rb
index 1ec0975..1131a12 100644
--- a/www/roster/views/group.js.rb
+++ b/www/roster/views/group.js.rb
@@ -9,7 +9,7 @@ class Group < React
   end
 
   def render
-    group = @@group
+    group = @group
     members = group.members.keys().sort_by {|id| group.members[id]}
 
     if group.type == 'LDAP auth group'
@@ -48,7 +48,6 @@ class Group < React
         end
 
         for id in @pending
-          next if group.members[id]
           _GroupMember id: id, name: @pending[id], auth: auth, 
             pending: true
         end
@@ -70,6 +69,27 @@ class Group < React
     _GroupConfirm group: group.id, update: self.update if auth
   end
 
+  # capture group on initial load
+  def componentWillMount()
+    self.update(@@group)
+  end
+
+  # capture group on subsequent loads
+  def componentWillReceiveProps()
+    self.update(@@group)
+  end
+
+  # update group from conformation form
+  def update(group)
+    # remove members of the group from pending lists
+    for id in group
+      @pending.delete(id)
+    end
+
+    # capture group
+    @group = group
+  end
+
   # open search box
   def select()
     window.getSelection().removeAllRanges()
@@ -97,22 +117,18 @@ class GroupMember < React
       _td {_a @@id, href: "committer/#{@@id}"}
       _td @@name
 
-      if @@pending
-        _td do
-          _button.btn.btn_success 'Add to Group',
-            data_action: 'add group',
+      _td data_id: @@id do
+        if @@pending
+          _button.btn.btn_success 'Add to Group', data_action: 'add',
             data_target: '#confirm', data_toggle: 'modal',
             data_confirmation: "Add #{@@name} to"
-        end
-      elsif @state == :open
-        _td do
-          _button.btn.btn_warning 'Remove from Group',
-            data_action: 'remove group',
+        elsif @state == :open
+          _button.btn.btn_warning 'Remove from Group', data_action: 'remove',
             data_target: '#confirm', data_toggle: 'modal',
             data_confirmation: "Remove #{@@name} from"
+        else
+          _span ''
         end
-      else
-        _td ''
       end
     end
   end
@@ -184,19 +200,15 @@ class GroupConfirm < React
   end
 
   def post()
-    # parse action extracted from the button
-    targets = @action.split(' ')
-    action = targets.shift()
-
     # construct arguments to fetch
     args = {
       method: 'post',
       credentials: 'include',
       headers: {'Content-Type' => 'application/json'},
-      body: {group: @@group, id: @id, action: action, targets: targets}.inspect
+      body: {group: @@group, id: @id, action: @action}.inspect
     }
 
-    fetch('actions/group', args).then {|response|
+    fetch('actions/authgroup', args).then {|response|
       content_type = response.headers.get('content-type') || ''
       if response.status == 200 and content_type.include? 'json'
         response.json().then do |json|

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message