Fixing the right menu auto demote/kick.

Leandro Silva [09-23-18 - 22:34]
Fixing the right menu auto demote/kick.
Filename
LeoGuildManager.lua
LeoGuildManager.txt
LeoGuildManagerUI.lua
diff --git a/LeoGuildManager.lua b/LeoGuildManager.lua
index 0c11489..65d190f 100644
--- a/LeoGuildManager.lua
+++ b/LeoGuildManager.lua
@@ -2,7 +2,7 @@
 LeoGM = {}
 LeoGM.name = "LeoGuildManager"
 LeoGM.displayName = "Leo's Guild Manager"
-LeoGM.version = "0.9.3"
+LeoGM.version = "0.9.4"
 LeoGM.chatPrefix = "|c39B027" .. LeoGM.name .. "|r: "
 LeoGM.panelList = { "Rules", "Purge" }
 LeoGM.members = {}
@@ -97,6 +97,8 @@ function LeoGM.BuildSalesHistory(guildId, scanSince)

     if LeoGM.isScanning then return nil end

+    LeoGMWindowPurgePanelListResult:SetText("Scanning guild sales ... this can take a few minutes")
+
     LeoGMWindowPurgePanelListButton:SetEnabled(false)
     LeoGMWindowPurgePanelLoadingIcon:SetHidden(false)
     LeoGMWindowPurgePanelLoadingIcon.animation:PlayForward()
@@ -324,8 +326,8 @@ function LeoGM.DoDepositsScan(guildNum, checkOlder, scanSince, startIndex, endIn
     LeoGMWindowPurgePanelListButton:SetEnabled(true)
     LeoGMWindowPurgePanelLoadingIcon:SetHidden(true)
     LeoGMWindowPurgePanelLoadingIcon.animation:Stop()
-    LeoGM.PostScan()
-    --LeoGM.BuildSalesHistory(guildNum, scanSince)
+    --LeoGM.PostScan()
+    LeoGM.BuildSalesHistory(guildNum, scanSince)
 end

 function LeoGM.ScanOlderDeposits(guildNum, scanSince, oldNumEvents, badLoads)
@@ -358,6 +360,7 @@ function LeoGM.PostScan()
             end
         end
     end
+    --[[
     if MasterMerchant then
         for sn, sellerData in pairs(MasterMerchant.guildSales[LeoGM.savedVariables.selectedGuild].sellers) do
             for _, member in pairs(LeoGM.members) do
@@ -367,7 +370,7 @@ function LeoGM.PostScan()
             end
         end
     end
-    --[[
+    ]]
     for _, event in pairs(LeoGM.salesEvents) do
         for _, member in pairs(LeoGM.members) do
             if event.seller == member.name then
@@ -376,7 +379,6 @@ function LeoGM.PostScan()
             end
         end
     end
-    ]]
     LeoGM.memberScroll:RefreshData()
 end

diff --git a/LeoGuildManager.txt b/LeoGuildManager.txt
index 0d567f3..b74752c 100644
--- a/LeoGuildManager.txt
+++ b/LeoGuildManager.txt
@@ -1,6 +1,6 @@
 ## Title: Leo's Guild Manager
 ## APIVersion: 100024
-## Version: 0.9.3
+## Version: 0.9.4
 ## Author: |c39B027@LeandroSilva|r
 ## SavedVariables: LeoGMSavedVariables
 ## DependsOn: LibStub LibFeedback MasterMerchant
diff --git a/LeoGuildManagerUI.lua b/LeoGuildManagerUI.lua
index 550cae5..411a9e2 100644
--- a/LeoGuildManagerUI.lua
+++ b/LeoGuildManagerUI.lua
@@ -40,10 +40,10 @@ function LeoGM.UserClick(control, button, upInside)
             --AddMenuItem(GetString(SI_SOCIAL_MENU_EDIT_NOTE), LeoGM.EditMemberNote(control, player))
         end
         if DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_DEMOTE) then
-            AddMenuItem(GetString(SI_GUILD_DEMOTE), GuildDemote(guildId, player))
+            AddMenuItem(GetString(SI_GUILD_DEMOTE), function() d(player); GuildDemote(guildId, player) end)
         end
         if DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_REMOVE) then
-            AddMenuItem(GetString(SI_GUILD_REMOVE), GuildRemove(guildId, player))
+            AddMenuItem(GetString(SI_GUILD_REMOVE), function() GuildRemove(guildId, player) end)
         end
         ShowMenu(control)
     end
@@ -262,9 +262,32 @@ end

 function LeoGM.ListPurge()
     local guildId = LeoGM.GetGuilds(LeoGM.savedVariables.selectedGuild)
+
+    if not DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_BANK_VIEW_GOLD) then
+        LeoGMWindowPurgePanelListResult:SetText("|cFF2222You don't have permission to scan guild gold deposits.|r")
+        return
+    end
+    LeoGMWindowPurgePanelListResult:SetText("Sorry, fixing the MM integration. Will be back soon.")
+    --[[
+    LeoGMWindowPurgePanelListResult:SetText("Scanning gold deposits ...")
+    d(MasterMerchant.version)
+    d(#MasterMerchant.SRIndex)
+    d(#MasterMerchant.SSIndex)
+    d(#MasterMerchant.guildSales)
+    d(#MasterMerchant.guildSales[LeoGM.savedVariables.selectedGuild])
+    d(#MasterMerchant.guildSales[LeoGM.savedVariables.selectedGuild].sellers)
+    if not MasterMerchant or
+            not MasterMerchant.guildSales[LeoGM.savedVariables.selectedGuild] or
+            not MasterMerchant.guildSales[LeoGM.savedVariables.selectedGuild].sellers or
+            #MasterMerchant.guildSales[LeoGM.savedVariables.selectedGuild].sellers == 0
+    then
+        LeoGMWindowPurgePanelListResult:SetText("|cFF2222MasterMerchant sales data not found for this guild.|r Try again in a few moments if it is still initializing.")
+        return
+    end
+    ]]
     LeoGM.GetGuildMembers(guildId)
     local scanSince = GetTimeStamp() - 7 * 24 * 60 * 60
-    LeoGM.BuildDepositsHistory(guildId, scanSince)
+    --LeoGM.BuildDepositsHistory(guildId, scanSince)
 end

 function LeoGM.InitializeUI()