Skip to content

Commit

Permalink
Merge pull request #1680 from cryptpad/requestedit_button
Browse files Browse the repository at this point in the history
'Request edit' button
  • Loading branch information
yflory authored Dec 12, 2024
2 parents 48eabac + 650bb23 commit 4c0b2d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion www/common/inner/access.js
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ define([
var owned = Modal.isOwned(Env, data);

// Request edit access
if (common.isLoggedIn() && data.roHref && !owned && !opts.calendar && priv.app !== 'form') {
if (common.isLoggedIn() && data.roHref && !owned && !opts.calendar && priv.app !== 'form' && !data.href) {
var requestButton = h('button.btn.btn-secondary.no-margin.cp-access-margin-right',
Messages.requestEdit_button);
var requestBlock = h('p', requestButton);
Expand Down
8 changes: 7 additions & 1 deletion www/common/inner/common-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ define([
// Access modal and the pad is not stored: get the hashes from outer
var hashes = priv.hashes || {};
// For calendars, individual href is passed via opts
data.href = ((priv.app === 'calendar') && opts.href) || Hash.hashToHref(hashes.editHash || hashes.fileHash, priv.app);
if (priv.app === 'calendar') {
data.href = opts.href;
} else if (hashes.editHash || hashes.fileHash) {
data.href = Hash.hashToHref(hashes.editHash || hashes.fileHash, priv.app);
} else {
data.href = undefined;
}
if (hashes.viewHash) {
data.roHref = Hash.hashToHref(hashes.viewHash, priv.app);
}
Expand Down

0 comments on commit 4c0b2d2

Please sign in to comment.