Skip to content

Commit b4259c6

Browse files
committed
changed handling of check for comments being enabled on Piwigo
1 parent 0143916 commit b4259c6

3 files changed

Lines changed: 18 additions & 22 deletions

File tree

piwigoPublish.lrplugin/PiwigoAPI.lua

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,14 +1430,14 @@ end
14301430
function PiwigoAPI.getCommentInfos(propertyTable)
14311431
-- return output from pwg.userComments.getList
14321432
-- primarily used to check if comments are enabled on this Piwigo host
1433-
log:info("PiwigoAPI.getComments")
1433+
log:info("PiwigoAPI.getCommentInfos")
14341434
local rtnStatus = {}
14351435
rtnStatus.status = false
14361436
rtnStatus.commentsEnabled = false
14371437
-- successful connection, now get user role and token via pwg.session.getStatus
14381438
local Params = { {
14391439
name = "method",
1440-
value = "pwg.pwg.userComments.getList"
1440+
value = "pwg.userComments.getList"
14411441
} }
14421442
-- build headers to include cookies from pwConnect call
14431443
local headers = {}
@@ -1448,9 +1448,9 @@ function PiwigoAPI.getCommentInfos(propertyTable)
14481448
end
14491449
local getResponse = httpGet(propertyTable.pwurl, Params, headers)
14501450
if (not getResponse.response) then
1451-
log:info("PiwigoAPI.getComments - Params\n" .. utils.serialiseVar(Params))
1452-
log:info("PiwigoAPI.getComments - headers\n" .. utils.serialiseVar(headers))
1453-
log:info("PiwigoAPI.getComments - getResponse\n" .. utils.serialiseVar(getResponse))
1451+
log:info("PiwigoAPI.getCommentInfos - Params\n" .. utils.serialiseVar(Params))
1452+
log:info("PiwigoAPI.getCommentInfos - headers\n" .. utils.serialiseVar(headers))
1453+
log:info("PiwigoAPI.getCommentInfos - getResponse\n" .. utils.serialiseVar(getResponse))
14541454
LrDialogs.message("Cannot get comments information from Piwigo - Unknown error")
14551455
return rtnStatus
14561456
end
@@ -2340,10 +2340,6 @@ function PiwigoAPI.deletePhoto(propertyTable, pwCatID, pwImageID, callStatus)
23402340
value = propertyTable.token
23412341
} }
23422342

2343-
log:info("PiwigoAPI.deletePhoto - propertyTable \n " .. utils.serialiseVar(propertyTable))
2344-
log:info("PiwigoAPI.deletePhoto - params \n" .. utils.serialiseVar(params))
2345-
-- log:info("PiwigoAPI.deletePhoto - headrs \n" .. utils.serialiseVar(headers))
2346-
23472343
local httpResponse, httpHeaders = LrHttp.postMultipart(propertyTable.pwurl, params, {
23482344
headers = {
23492345
field = "Cookie",
@@ -2352,9 +2348,6 @@ function PiwigoAPI.deletePhoto(propertyTable, pwCatID, pwImageID, callStatus)
23522348
}
23532349
})
23542350

2355-
log:info("PiwigoAPI.deletePhoto - httpResponse \n" .. utils.serialiseVar(httpResponse))
2356-
log:info("PiwigoAPI.deletePhoto - httpHeaders \n" .. utils.serialiseVar(httpHeaders))
2357-
23582351
local body
23592352
if httpResponse then
23602353
body = JSON:decode(httpResponse)
@@ -2365,10 +2358,18 @@ function PiwigoAPI.deletePhoto(propertyTable, pwCatID, pwImageID, callStatus)
23652358
callStatus.status = true
23662359
callStatus.statusMsg = ""
23672360
else
2361+
log:info("PiwigoAPI.deletePhoto - propertyTable \n " .. utils.serialiseVar(propertyTable))
2362+
log:info("PiwigoAPI.deletePhoto - params \n" .. utils.serialiseVar(params))
2363+
log:info("PiwigoAPI.deletePhoto - httpResponse \n" .. utils.serialiseVar(httpResponse))
2364+
log:info("PiwigoAPI.deletePhoto - httpHeaders \n" .. utils.serialiseVar(httpHeaders))
23682365
callStatus.status = false
23692366
callStatus.statusMsg = body.message or ""
23702367
end
23712368
else
2369+
log:info("PiwigoAPI.deletePhoto - propertyTable \n " .. utils.serialiseVar(propertyTable))
2370+
log:info("PiwigoAPI.deletePhoto - params \n" .. utils.serialiseVar(params))
2371+
log:info("PiwigoAPI.deletePhoto - httpResponse \n" .. utils.serialiseVar(httpResponse))
2372+
log:info("PiwigoAPI.deletePhoto - httpHeaders \n" .. utils.serialiseVar(httpHeaders))
23722373
callStatus.status = false
23732374
callStatus.statusMsg = body.message or ""
23742375
end
@@ -2465,12 +2466,6 @@ function PiwigoAPI.addComment(publishSettings, metaData)
24652466
return false
24662467
end
24672468
--end
2468-
-- log:info("PiwigoAPI.addComment - publishSettings\n" .. utils.serialiseVar(publishSettings))
2469-
-- check role is admin level
2470-
--if publishSettings.userStatus ~= "webmaster" then
2471-
-- LrDialogs.message("PiwigoAPI.addComment - user needs webmaster role ")
2472-
-- return false
2473-
--end
24742469

24752470
-- get antispam token from image details (unique for each image)
24762471
local rtnStatus = PiwigoAPI.checkPhoto(publishSettings, metaData.remoteId)

piwigoPublish.lrplugin/PublishServiceProvider.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ return {
8686

8787
-- Images Processing function
8888
processRenderedPhotos = PublishTask.processRenderedPhotos,
89-
canAddCommentsToService = PublishTask.PublishTaskcanAddCommentsToService,
89+
canAddCommentsToService = PublishTask.canAddCommentsToService,
9090
addCommentToPublishedPhoto = PublishTask.addCommentToPublishedPhoto,
9191
getCommentsFromPublishedCollection = PublishTask.getCommentsFromPublishedCollection,
9292
deletePhotosFromPublishedCollection = PublishTask.deletePhotosFromPublishedCollection,

piwigoPublish.lrplugin/PublishTask.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function PublishTask.processRenderedPhotos(functionContext, exportContext)
5757
serviceState = PWStatusManager.getServiceState(publishService)
5858
end
5959
log:info("PublishTask.processRenderedPhotos - serviceState " .. utils.serialiseVar(serviceState))
60-
if serviceState.isCloningSync then
60+
if serviceState.isCloningSync and serviceState.isCloningSync == true then
6161
PWStatusManager.setisCloningSync(publishService, false)
6262
-- use minimal render photos for smart collection cloning
6363
PublishTask.processCloneSync(functionContext, exportContext)
@@ -495,10 +495,11 @@ function PublishTask.getCommentsFromPublishedCollection(publishSettings, arrayOf
495495
end
496496

497497
-- ************************************************
498-
function PublishTaskcanAddCommentsToService(publishSettings)
498+
function PublishTask.canAddCommentsToService(publishSettings)
499499
log:info("PublishTask.canAddCommentToPublishedPhoto")
500500
-- check if Piwgo has comments enabled
501-
local commentsEnabled = PiwigoAPI.pwCheckComments(publishSettings)
501+
--local commentsEnabled = PiwigoAPI.pwCheckComments(publishSettings)
502+
local commentsEnabled = true
502503
return commentsEnabled
503504
end
504505

0 commit comments

Comments
 (0)