Skip to content

Commit

Permalink
wsd: remove unused (Is)ViewWithCommentsFileExtension(s)
Browse files Browse the repository at this point in the history
Change-Id: I25158862746ce6a3e4ee16ff9d661ec96810ce24
Signed-off-by: Ashod Nakashian <[email protected]>
  • Loading branch information
Ashod committed May 20, 2024
1 parent f3b6939 commit 0dc551b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
1 change: 0 additions & 1 deletion wsd/COOLWSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ static std::chrono::milliseconds careerSpanMs(std::chrono::milliseconds::zero())
int ChildSpawnTimeoutMs = CHILD_TIMEOUT_MS * 4;
std::atomic<unsigned> COOLWSD::NumConnections;
std::unordered_set<std::string> COOLWSD::EditFileExtensions;
std::unordered_set<std::string> COOLWSD::ViewWithCommentsFileExtensions;

#if MOBILEAPP

Expand Down
17 changes: 0 additions & 17 deletions wsd/COOLWSD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ class COOLWSD final : public Poco::Util::ServerApplication,
#endif

static std::unordered_set<std::string> EditFileExtensions;
static std::unordered_set<std::string> ViewWithCommentsFileExtensions;
static unsigned MaxConnections;
static unsigned MaxDocuments;
static std::string OverrideWatermark;
Expand Down Expand Up @@ -384,22 +383,6 @@ class COOLWSD final : public Poco::Util::ServerApplication,
return EditFileExtensions.find(lowerCaseExtension) == EditFileExtensions.end();
}

/// Return true if extension is marked as view_comment action in discovery.xml.
static bool IsViewWithCommentsFileExtension(const std::string& extension)
{

std::string lowerCaseExtension = extension;
std::transform(lowerCaseExtension.begin(), lowerCaseExtension.end(), lowerCaseExtension.begin(), ::tolower);
if (Util::isMobileApp())
{
if (lowerCaseExtension == "pdf")
return true; // true for only pdf - it is not editable
return false; // mark everything else editable on mobile
}
return ViewWithCommentsFileExtensions.find(lowerCaseExtension) !=
ViewWithCommentsFileExtensions.end();
}

/// Returns the value of the specified application configuration,
/// or the default, if one doesn't exist.
template<typename T>
Expand Down
6 changes: 3 additions & 3 deletions wsd/ClientRequestDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1903,9 +1903,9 @@ std::string ClientRequestDispatcher::getDiscoveryXML()
}
else if (elem->getAttribute("name") == "view_comment")
{
const std::string ext = elem->getAttribute("ext");
if (COOLWSD::ViewWithCommentsFileExtensions.insert(ext).second) // Skip duplicates.
LOG_DBG_S("Enabling commenting on [" << ext << "] extension files");
// We don't seem to treat this list differently.
// The assumption seems to be that if a file is not editable,
// then it's view-only. And if it's view-only, it supports comments.
}
}

Expand Down

0 comments on commit 0dc551b

Please sign in to comment.