mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
core: allow free users to assign same 5 tags without limits
This commit is contained in:
committed by
Abdullah Atta
parent
74bcd1b27d
commit
b5ab8e5d3e
@@ -22,6 +22,7 @@ import { makeId } from "../utils/id";
|
||||
import { deleteItems, hasItem } from "../utils/array";
|
||||
import setManipulator from "../utils/set";
|
||||
import { Mutex } from "async-mutex";
|
||||
import { checkIsUserPremium, CHECK_IDS } from "../common";
|
||||
|
||||
export default class Tags extends Collection {
|
||||
constructor(db, name, cached) {
|
||||
@@ -50,6 +51,13 @@ export default class Tags extends Collection {
|
||||
if (tag && !noteIds.length)
|
||||
throw new Error("A tag with this id already exists.");
|
||||
|
||||
if (
|
||||
!tag &&
|
||||
this.all.length >= 5 &&
|
||||
!(await checkIsUserPremium(CHECK_IDS.noteTag))
|
||||
)
|
||||
return;
|
||||
|
||||
tag = tag || {
|
||||
title: tagId
|
||||
};
|
||||
|
||||
@@ -160,12 +160,6 @@ export default class Note {
|
||||
}
|
||||
|
||||
async tag(tag) {
|
||||
if (
|
||||
this._db.tags.all.length >= 5 &&
|
||||
!(await checkIsUserPremium(CHECK_IDS.noteTag))
|
||||
)
|
||||
return;
|
||||
|
||||
let tagItem = await this._db.tags.add(tag, this._note.id);
|
||||
if (addItem(this._note.tags, tagItem.title))
|
||||
await this._db.notes.add(this._note);
|
||||
|
||||
Reference in New Issue
Block a user