loolwsd: disable editlock in multiview
Change-Id: I4df2d8a321e160ce226c2e22aa754cd6e5b2c755 Reviewed-on: https://gerrit.libreoffice.org/25063 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
parent
b41f0a6ea3
commit
76991dd325
3 changed files with 10 additions and 9 deletions
|
@ -40,7 +40,7 @@ ClientSession::ClientSession(const std::string& id,
|
|||
LOOLSession(id, Kind::ToClient, ws),
|
||||
_docBroker(docBroker),
|
||||
_queue(queue),
|
||||
_haveEditLock(false),
|
||||
_haveEditLock(std::getenv("LOK_VIEW_CALLBACK")),
|
||||
_loadFailed(false),
|
||||
_loadPart(-1)
|
||||
{
|
||||
|
@ -222,10 +222,9 @@ bool ClientSession::getStatus(const char *buffer, int length)
|
|||
sendTextFrame(status);
|
||||
|
||||
// And let clients know if they hold the edit lock.
|
||||
std::string message = "editlock: ";
|
||||
message += std::to_string(isEditLocked());
|
||||
Log::debug("Forwarding [" + message + "] in response to status.");
|
||||
sendTextFrame(message);
|
||||
const auto msg = "editlock: " + std::to_string(isEditLocked());
|
||||
Log::debug("Returning [" + msg + "] in response to status.");
|
||||
sendTextFrame(msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -243,8 +242,10 @@ bool ClientSession::getStatus(const char *buffer, int length)
|
|||
void ClientSession::setEditLock(const bool value)
|
||||
{
|
||||
// Update the sate and forward to child.
|
||||
_haveEditLock = value;
|
||||
const auto msg = std::string("editlock: ") + (value ? "1" : "0");
|
||||
markEditLock(value);
|
||||
const auto msg = "editlock: " + std::to_string(isEditLocked());
|
||||
const auto mv = std::getenv("LOK_VIEW_CALLBACK") ? "1" : "0";
|
||||
Log::debug("Forwarding [" + msg + "] to set editlock to " + std::to_string(value) + ". MultiView: " + mv);
|
||||
forwardToPeer(msg.data(), msg.size());
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
virtual ~ClientSession();
|
||||
|
||||
void setEditLock(const bool value);
|
||||
void markEditLock(const bool value) { _haveEditLock = value; }
|
||||
void markEditLock(const bool value) { _haveEditLock = (value || std::getenv("LOK_VIEW_CALLBACK")); }
|
||||
bool isEditLocked() const { return _haveEditLock; }
|
||||
|
||||
void setPeer(const std::shared_ptr<PrisonerSession>& peer) { _peer = peer; }
|
||||
|
|
|
@ -275,7 +275,7 @@ bool DocumentBroker::sendUnoSave()
|
|||
Log::info("Autosave triggered for doc [" + _docKey + "].");
|
||||
Util::assertIsLocked(_mutex);
|
||||
|
||||
// Save using session holding the edit-lock
|
||||
// Save using session holding the edit-lock (or first if multview).
|
||||
for (auto& sessionIt: _sessions)
|
||||
{
|
||||
if (sessionIt.second->isEditLocked())
|
||||
|
|
Loading…
Reference in a new issue