|
96 | 96 | $tr.attr('data-share-permissions', permission) |
97 | 97 | } |
98 | 98 |
|
| 99 | + if (fileData.remoteId) { |
| 100 | + $tr.attr('data-remote-id', fileData.remoteId) |
| 101 | + } |
| 102 | + |
| 103 | + if (fileData.shareType) { |
| 104 | + $tr.attr('data-share-type', fileData.shareType) |
| 105 | + } |
| 106 | + |
99 | 107 | // add row with expiration date for link only shares - influenced by _createRow of filelist |
100 | 108 | if (this._linksOnly) { |
101 | 109 | var expirationTimestamp = 0 |
|
212 | 220 | } |
213 | 221 | } |
214 | 222 |
|
| 223 | + var pendingRemoteShares = { |
| 224 | + url: OC.linkToOCS('apps/files_sharing/api/v1/remote_shares', 2) + 'pending', |
| 225 | + /* jshint camelcase: false */ |
| 226 | + data: { |
| 227 | + format: 'json' |
| 228 | + }, |
| 229 | + type: 'GET', |
| 230 | + beforeSend: function(xhr) { |
| 231 | + xhr.setRequestHeader('OCS-APIREQUEST', 'true') |
| 232 | + } |
| 233 | + } |
| 234 | + |
215 | 235 | var shares = { |
216 | 236 | url: OC.linkToOCS('apps/files_sharing/api/v1') + 'shares', |
217 | 237 | /* jshint camelcase: false */ |
|
245 | 265 | promises.push($.ajax(deletedShares)) |
246 | 266 | } else if (this._showPending) { |
247 | 267 | promises.push($.ajax(pendingShares)) |
| 268 | + promises.push($.ajax(pendingRemoteShares)) |
248 | 269 | } else { |
249 | 270 | promises.push($.ajax(shares)) |
250 | 271 |
|
|
292 | 313 | } |
293 | 314 |
|
294 | 315 | if (additionalShares && additionalShares.ocs && additionalShares.ocs.data) { |
295 | | - files = files.concat(this._makeFilesFromShares(additionalShares.ocs.data, !this._sharedWithUser)) |
| 316 | + if (this._showPending) { |
| 317 | + // in this case the second callback is about pending remote shares |
| 318 | + files = files.concat(this._makeFilesFromRemoteShares(additionalShares.ocs.data)) |
| 319 | + } else { |
| 320 | + files = files.concat(this._makeFilesFromShares(additionalShares.ocs.data, !this._sharedWithUser)) |
| 321 | + } |
296 | 322 | } |
297 | 323 |
|
298 | 324 | this.setFiles(files) |
|
311 | 337 | mtime: share.mtime * 1000, |
312 | 338 | mimetype: share.mimetype, |
313 | 339 | type: share.type, |
| 340 | + // remote share types are different and need to be mapped |
| 341 | + shareType: (parseInt(share.share_type, 10) === 1) ? OC.Share.SHARE_TYPE_REMOTE_GROUP : OC.Share.SHARE_TYPE_REMOTE, |
314 | 342 | id: share.file_id, |
315 | 343 | path: OC.dirname(share.mountpoint), |
316 | 344 | permissions: share.permissions, |
317 | 345 | tags: share.tags || [] |
318 | 346 | } |
319 | 347 |
|
| 348 | + if (share.remote_id) { |
| 349 | + // remote share |
| 350 | + if (share.accepted !== '1') { |
| 351 | + file.name = OC.basename(share.name) |
| 352 | + file.path = '/' |
| 353 | + } |
| 354 | + file.remoteId = share.remote_id |
| 355 | + file.shareOwnerId = share.owner |
| 356 | + } |
| 357 | + |
| 358 | + if (!file.mimetype) { |
| 359 | + // pending shares usually have no type, so default to showing a directory icon |
| 360 | + file.mimetype = 'dir-shared' |
| 361 | + } |
| 362 | + |
320 | 363 | file.shares = [{ |
321 | 364 | id: share.id, |
322 | 365 | type: OC.Share.SHARE_TYPE_REMOTE |
|
0 commit comments