Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sbt-dependency-tree to 1.10.0 #414

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions appsv/model/src/main/scala/com/debiki/core/Post.scala
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ object PostType {
*/
case object Flag_later extends PostType(-1) // probably not 51

// Probably not. Instead, it's nice with different bookmark types, e.g. a Reply-to
// bookmark, a Read-later bookmark, a References bookmark (if you've read it already).
// Then, tags with values is simpler, for now. The tag type is the bookmark type,
// and optional tag value is a bookmark description.
/** Later: Bookmarks.
*
* A tree of bookmarks would be nicely stored as posts? Posts form a tree already,
Expand Down
3 changes: 3 additions & 0 deletions appsv/model/src/main/scala/com/debiki/core/Prelude.scala
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,8 @@ object Prelude { CLEAN_UP; RENAME // to BugDie and re-export the interesting
*/
}

/* Hmm, old stuff. REMOVE?

// This isn't really a secret salt. A secret salt should be kept secret
// in the database, fetched via Dao.secretSalt and specified via useSalt().
// I think the salt better be fairly long, otherwise it'd be possible to
Expand All @@ -762,6 +764,7 @@ object Prelude { CLEAN_UP; RENAME // to BugDie and re-export the interesting

def saltAndHashEmail: St => St = saltAndHash(hashLengthEmail) _
def saltAndHashIp: St => St = saltAndHash(hashLengthIp) _
*/

SECURITY; COULD_OPTIMIZE // use BLAKE3 instead.
private def mdSha1: js.MessageDigest = js.MessageDigest.getInstance("SHA-1") // not thread safe
Expand Down
19 changes: 16 additions & 3 deletions appsv/model/src/main/scala/com/debiki/core/types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ import com.debiki.core.Prelude._
case class TagType(
id: TagTypeId,
refId: Opt[RefId],
canTagWhat: i32,
scopedToPatId: Opt[PatId] = None,
//isPersonal: Bo, // Bookmarks should always be? But then, ThingKind.Bookmark is enough?
canTagWhat: i32, // CHANGE to ThingKind.Tag|Badge|Bookmark ?
urlSlug: Opt[St],
dispName: St,
createdById: PatId,
Expand Down Expand Up @@ -73,11 +75,22 @@ object TypeValueType {
// Sync w db constr: value_type_d_c_lt3000_for_now.
// Sync w db constr: value_type_d_c_gtem3_nz
// Sync w Typescript enum TypeValueType.
// case object BoolTrue extends TypeValueType(-2)
// case object BoolFalse extends TypeValueType(-1)

// Booleans: No need to store both a type and a value β€” can instead use
// "types" true & false, and skip the value.
// case object BoolTrue extends TypeValueType(-1)
// case object BoolFalse extends TypeValueType(-2)
// (case object None/Null/Undefined? β€” Can just leave the value empty instead?)

case object Int32 extends TypeValueType(1)
case object Flt64 extends TypeValueType(5)
case object StrKwd extends TypeValueType(17)
case object StrTxt extends TypeValueType(18)

//case object Task extends TypeValueType(?)

//case object PostLink extends TypeValueType(?)
//case object PatLink extends TypeValueType(?)

def fromInt(value: i32): Opt[TypeValueType] = Some(value match {
case Int32.IntVal => Int32
Expand Down
43 changes: 43 additions & 0 deletions appsv/rdb/src/main/resources/db/migration/db-wip.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
-- Misc new domains?
--=============================================================================

-- BUG: Oooops, in the domain http_url_d, the pattern 'https?:...' doesn't
-- start & end with ^ and $. Write an update stmt that removes
-- any not-allowed stuff?
-- Oh, I've corrected that already β€” at the top of:
-- appsv/rdb/src/main/resources/db/migration/y2021/v407__upvote_features.sql



-- *_u: For unused columns, just sketching the future:
create domain i16_u smallint;
create domain i32_u int;
Expand Down Expand Up @@ -437,6 +445,8 @@ create unique index types_u_anypat_basetype_subtype_urlslug on types_t (

-- upd triggers too!
alter table post_actions3 rename to pat_node_rels_t; -- not: pat_rels_t;
-- Also see: [tags_vs_pat_node_rels] β€” because pat_node_rels_t is
-- pretty similar to tags_t.

alter table post_actions3 drop column action_id; -- ?. Already noted below in "delete: ...".
alter table post_actions3 rename to created_at to added_at_c;
Expand Down Expand Up @@ -582,6 +592,39 @@ $_$;
-- about_tag_id_c,
-- )

-- Maybe a menu_t? See wip_v427__sidebar_menu.sql (or v427__sidebar_menu.sql)

-- [bookmarks] Do they want an 'order' or 'priority' value? Or can pat
-- use val_i32_c for that? But the software wouldn't know ...?
-- Maybe:
-- If one wants to sort one's bookmark in maybe a priority order.
-- (Maybe not of any use for tags?)
-- > 0 means place first, ascending.
-- < 0 means place last (asc or desc? from end?), for less important bookmarks.
-- null (or 0) means in the middle (after the > 0 but before the < 0)
-- Or rename to priority?
alter table tags_t
add column order_c f32_nz_d;
-- No! Add a types_t.value_type_c = Bookmark instead? ... Or, no. value_type_c = Task
-- instead? And kind_c = Bookmark? Then:
-- tagtype_id_c = e.g. read-later, reply-to, reference, to-do, custom,
-- all of which have kind_c = KindOfThing.Bookmark
-- val_type_id_c = Task | PostLink
-- val_i32_c = remind-me-at (indexed as a date-time in ElasticSearch)
-- val_f64_c = priority (so can sort bookmarks by priority)
-- val_str_c = description
-- val_url_c
-- val_jsonb_c
-- val_i32_b_c = due at
-- val_f64_b_c
--
-- Then, people can configure *tags* to function as reminders too. Then
-- the tag appears in people's notification list, when it's time to remind them
-- (them being the types_t.scoped_to_pat_id_c group?
-- Or the tags_t.visible_only_to_pat_id_c group β€” no, that's just for
-- rendering pages, right.)

-- And change can_tag_what_c β€”β€”> kind_c = Tag | Badge | Bookmark (| TagBadge | NestedValue) ?


-- Split settings3 and pages3 into:
Expand Down
7 changes: 7 additions & 0 deletions appsv/rdb/src/main/resources/db/migration/r__comments.sql
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,13 @@ a '{}' after any numeric or text value, to indicate that there's json.
For now, urls and jsonb aren't allowed β€” only numbers and plain text.
$_$; -- '

------------------------------------------------------------------------
comment on column tags_t.visible_only_to_pat_id_c is $_$
Bookmarks are visible only to oneself, so we need to remember who may
see them. And there'll be private tags & badges, e.g. staff-only user
notes (see below), so this makes sense for tags & badges too.
$_$; -- '


--======================================================================
-- types_t (currently named tagtypes_t)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@


-- Bookmarks need visible_only_to_pat_id_c, since they're private (per person).
--
alter table tags_t
-- Ooops, this is an i32_d, should be an f64. Ok to change, not in use yet.
alter column val_f64_b_c type f64_d using (val_f64_b_c::f64_d),

-- E.g. about-user notes: Tag a user with a "Notes" badge, visible only to staff,
-- and share some notes about that user. (The post id would be the orig-post
-- (or title post?) of the page with notes about the user.)
add column val_post_id_c post_id_d,

-- When is this useful? A tag that points to a user? Feels it's needed, for symmetry.
-- Maybe to *suggest* assigning a task (the tagged post) to someone? If a
-- community creates such a tag type.
add column val_pat_id_c pat_id_d,

-- Could be helpul e.g. if marking pages which maybe should be moved to another
-- categories? To get an overview, and later on, move them?
add column val_cat_id_c cat_id_d,

-- E.g. one's bookmarks are visible only to oneself, and it's good to
-- have a way to "instantly" find all publicly visible tags,
-- plus all one's own bookmarks, on a page.
add column visible_only_to_pat_id_c pat_id_d,

-- fk ix: tags_valpostid_i
add constraint tags_valpostid_r_posts foreign key (site_id_c, val_post_id_c)
references posts3 (site_id, unique_post_id) deferrable,

-- fk ix: tags_i_valpatid
add constraint tags_valpatid_r_pats foreign key (site_id_c, val_pat_id_c)
references users3 (site_id, user_id) deferrable,

-- fk ix: tags_i_valcatid
add constraint tags_valcatid_r_cats foreign key (site_id_c, val_cat_id_c)
references categories3 (site_id, id) deferrable,

-- fk ix: tags_i_visibleonlytopatid
add constraint tags_visibleonlytopatid_r_pats foreign key (
site_id_c, visible_only_to_pat_id_c)
references users3 (site_id, user_id) deferrable;


-- Foreign key indexes:

create index tags_i_valpostid on tags_t (site_id_c, val_post_id_c)
where val_post_id_c is not null;

create index tags_i_valpatid on tags_t (site_id_c, val_pat_id_c)
where val_pat_id_c is not null;

create index tags_i_valcatid on tags_t (site_id_c, val_cat_id_c)
where val_cat_id_c is not null;

create index tags_i_visibleonlytopatid on tags_t (site_id_c, visible_only_to_pat_id_c)
where visible_only_to_pat_id_c is not null;


-- Rendering pages fast:

-- We look up the null rows, to find tags everyone may see, when rendering a page.
-- And look up rows with the current requester's id, to we can show han all hans bookmarks
-- on that page.

create index tags_i_onpostid_visibleonlytopatid on tags_t (
site_id_c, on_post_id_c, visible_only_to_pat_id_c)
where on_post_id_c is not null;

create index tags_i_onpatid_visibleonlytopatid on tags_t (
site_id_c, on_pat_id_c, visible_only_to_pat_id_c)
where on_pat_id_c is not null;
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@



create table menus_t (
site_id_c site_id_d,
menu_id_c menu_id_d,
-- If one wants to include some things from what-would-have-been
-- one's default menu. If null, then, looks up by looking at one's groups
-- and their menus.
default_menu_id menu_id_d
-- Currently only sidebar menu.
menu_type_c menu_type_d,
-- People in this group, will use this menu, by default. (If two groups one
-- is a member of have different menus, then what? Won't be a problem, for now:
-- there'd probably just be an Everyone group's menu, and one's own changes
-- if any.)
for_pat_id_c pat_id_d,
-- People in this group, can edit the menu items.
-- If null, the menu is for_pat_id_c's personal menu (someone's custom sidebar).
-- (A new table, perms_on_menus_t, would be overkill, right?)
managed_by_id_c pat_id_d,
);


-- icon class? Or a number into an images table?
create domain icon_d text_oneline_60_d;


create table menu_items_t (
site_id_c site_id_d,
menu_id_c menu_id_d,
item_id_c i32_lt2e9_gt1000_d,
parent_id_c i32_lt2e9_gt1000_d
position_c i32_nz_d,
disp_name_c tag_name_60_d,
abbr_name_c tag_name_15_d,
descr_c text_nonempty_ste1000_trimmed_d,
icon_c icon_d,

-- A link to all cats, all tags, groups, or something.
-- Or, inserts the contents from the default_menu_id β€” so one can
-- add a few menu items, without "losing" what-would-have-been the default menu
-- items at that place in the menu.
special_c i16_gz_d,
link_cat_id_c cat_id_d, -- link to a category
link_type_id_c type_d, -- link to a tag type, bookmark type, user badge type
link_page_id_c page_id_d, -- link to a page
link_pat_id_c pat_id_d, -- link to some group
link_url_path_c http_url_d, -- to a page in the forum
link_url_c http_url_d, -- to a page elsewhere, e.g. in one's website
);
2 changes: 2 additions & 0 deletions appsv/server/talkyard/server/JsX.scala
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ object JsX { RENAME // to JsonPaSe
val jOb = asJsObject(jsVal, "tag type")
val id = parseInt32(jOb, "id")
val refId = parseOptSt(jOb, "refId")
val scopedToPatId: Opt[PatId] = parseInt32(jOb, "scopedToPatId")
val canTagWhat = parseInt32(jOb, "canTagWhat")
val dispName = parseSt(jOb, "dispName")
val anySlug = parseOptSt(jOb, "urlSlug").noneIfBlank
Expand All @@ -889,6 +890,7 @@ object JsX { RENAME // to JsonPaSe
TagType(
id = id,
refId = refId,
scopedToPatId = scopedToPatId,
canTagWhat = canTagWhat,
urlSlug = anySlug,
dispName = dispName,
Expand Down
4 changes: 2 additions & 2 deletions appsv/server/talkyard/server/api/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ package object api {
}


/** A few well-known feature flags. Don't rename, are part of the API. */
/** A few well-known feature flags. Don't rename, are part of the API. [price_flags]*/
object FeatureFlags {

/** This site is for a nonprofit (e.g. a tax-exempt charity). */
Expand All @@ -191,7 +191,7 @@ package object api {

/** Price plan NN (names might change) maybe incl some bit flags with externally
* defined meanings. */
val ffPrPNNRegex: scala.util.matching.Regex = "ffPrP[0-9]{1,10}".r
val ffPrPNNRegex: scala.util.matching.Regex = "ffPrP[0-9a-zA-Z_]{1,10}".r

private val allowedNewSiteExactFlags = Vec(ff4Nnp, ff4Nfp, ff4Edu, ff4Biz, ff4EmCo)

Expand Down
1 change: 1 addition & 0 deletions client/app-more/more-bundle-already-loaded.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ declare namespace debiki2.nopage {
declare namespace debiki2.tags {
var routes;
function openTagDropdown(atRect, ps);
function openBookmarkDropdown(atRect, ps);
}

declare namespace debiki2.titleeditor {
Expand Down
Loading