mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
lint: src/node/db/ReadOnlyManager.js
This commit is contained in:
parent
e06b9442e0
commit
5ce255c789
1 changed files with 5 additions and 8 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
'use strict';
|
||||||
/**
|
/**
|
||||||
* The ReadOnlyManager manages the database and rendering releated to read only pads
|
* The ReadOnlyManager manages the database and rendering releated to read only pads
|
||||||
*/
|
*/
|
||||||
|
@ -27,15 +28,13 @@ const randomString = require('../utils/randomstring');
|
||||||
* checks if the id pattern matches a read-only pad id
|
* checks if the id pattern matches a read-only pad id
|
||||||
* @param {String} the pad's id
|
* @param {String} the pad's id
|
||||||
*/
|
*/
|
||||||
exports.isReadOnlyId = function (id) {
|
exports.isReadOnlyId = (id) => id.indexOf('r.') === 0;
|
||||||
return id.indexOf('r.') === 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns a read only id for a pad
|
* returns a read only id for a pad
|
||||||
* @param {String} padId the id of the pad
|
* @param {String} padId the id of the pad
|
||||||
*/
|
*/
|
||||||
exports.getReadOnlyId = async function (padId) {
|
exports.getReadOnlyId = async (padId) => {
|
||||||
// check if there is a pad2readonly entry
|
// check if there is a pad2readonly entry
|
||||||
let readOnlyId = await db.get(`pad2readonly:${padId}`);
|
let readOnlyId = await db.get(`pad2readonly:${padId}`);
|
||||||
|
|
||||||
|
@ -53,15 +52,13 @@ exports.getReadOnlyId = async function (padId) {
|
||||||
* returns the padId for a read only id
|
* returns the padId for a read only id
|
||||||
* @param {String} readOnlyId read only id
|
* @param {String} readOnlyId read only id
|
||||||
*/
|
*/
|
||||||
exports.getPadId = function (readOnlyId) {
|
exports.getPadId = (readOnlyId) => db.get(`readonly2pad:${readOnlyId}`);
|
||||||
return db.get(`readonly2pad:${readOnlyId}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the padId and readonlyPadId in an object for any id
|
* returns the padId and readonlyPadId in an object for any id
|
||||||
* @param {String} padIdOrReadonlyPadId read only id or real pad id
|
* @param {String} padIdOrReadonlyPadId read only id or real pad id
|
||||||
*/
|
*/
|
||||||
exports.getIds = async function (id) {
|
exports.getIds = async (id) => {
|
||||||
const readonly = (id.indexOf('r.') === 0);
|
const readonly = (id.indexOf('r.') === 0);
|
||||||
|
|
||||||
// Might be null, if this is an unknown read-only id
|
// Might be null, if this is an unknown read-only id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue