Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/develop' into feature/of…
Browse files Browse the repository at this point in the history
…fline-viewer-share

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
LinneyS committed Feb 9, 2024
2 parents 74715fb + 6e9e79f commit 47ab226
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Changed
- compatible with ownCloud Web 7.0
- list of users to protect ranges of cells
- offline viewer for share link

## Added
Expand Down
1 change: 1 addition & 0 deletions controller/editorapicontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ public function config($fileId, $filePath = null, $shareToken = null, $version =
"mode" => "strict",
"change" => false
];

$storageShare = $fileStorage->getShare();
if (method_exists($storageShare, "getAttributes")) {
$attributes = $storageShare->getAttributes();
Expand Down
21 changes: 11 additions & 10 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,14 @@ public function createNew($name, $dir, $templateId = null) {
* Get users
*
* @param $fileId - file identifier
* @param $operationType - type of operation
*
* @return array
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function users($fileId) {
public function users($fileId, $operationType = null) {
$this->logger->debug("Search users", ["app" => $this->appName]);
$result = [];

Expand Down Expand Up @@ -400,17 +401,17 @@ public function users($fileId) {

foreach ($users as $user) {
$email = $user->getEMailAddress();
if ($user->getUID() != $currentUserId && !empty($email)) {
array_push(
$result,
[
"email" => $email,
"name" => $user->getDisplayName()
]
);
if ($user->getUID() != $currentUserId && (!empty($email) || $operationType === "protect")) {
$userElement = [
"name" => $user->getDisplayName(),
"id" => $user->getUID()
];
if (!empty($email)) {
$userElement["email"] = $email;
}
array_push($result, $userElement);
}
}

return $result;
}

Expand Down
4 changes: 3 additions & 1 deletion js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,14 @@
};

OCA.Onlyoffice.onRequestUsers = function (event) {
$.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/users?fileId={fileId}",
let operationType = typeof(event.data.c) !== "undefined" ? event.data.c : null;
$.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/users?fileId={fileId}&operationType=" + operationType,
{
fileId: OCA.Onlyoffice.fileId || 0
}),
function onSuccess(response) {
OCA.Onlyoffice.docEditor.setUsers({
"c": operationType,
"users": response
});
});
Expand Down

0 comments on commit 47ab226

Please sign in to comment.