psy преди 2 часа
родител
ревизия
64d736dacd
променени са 5 файла, в които са добавени 6 реда и са изтрити 35 реда
  1. 1 1
      scripts/oasis-pub.js
  2. 2 3
      src/models/activity_model.js
  3. 1 1
      src/server/package-lock.json
  4. 1 1
      src/server/package.json
  5. 1 29
      src/views/activity_view.js

+ 1 - 1
scripts/oasis-pub.js

@@ -72,7 +72,7 @@ ssbClient(ssbConfig.keys, { remote, caps: ssbConfig.caps }).then(async (ssb) =>
         break;
       }
       case 'gossip': {
-        const r = await call(ssb.gossip.peers.bind(ssb.gossip));
+        const r = await call(ssb.conn.dbPeers.bind(ssb.conn));
         console.log(JSON.stringify(r, null, 2));
         break;
       }

+ 2 - 3
src/models/activity_model.js

@@ -11,7 +11,6 @@ const safeFeedId = (v) => {
 
 const isContentSane = (c) => {
   if (!c || typeof c !== 'object') return false;
-  if (c.type === 'contact') return !!safeFeedId(c.contact);
   if (c.type === 'about') {
     if (c.about === undefined) return true;
     if (typeof c.about === 'string' && ssbRef.isFeed(c.about)) return true;
@@ -180,6 +179,7 @@ module.exports = ({ cooler, tribeCrypto, tribesModel, padsModel }) => {
         if (!c) continue;
         if (typeof c === 'string' && c.endsWith('.box')) continue;
         if (c.type && HIDDEN_ENVELOPE_TYPES.has(c.type)) continue;
+        if (c.type === 'contact') continue;
         if (tribeCrypto && tribeCrypto.isTribeMsg(c)) {
           const r = fpIdx ? tribeCrypto.unwrapMsg(c, fpIdx) : null;
           if (!r || !r.body) continue;
@@ -208,8 +208,7 @@ module.exports = ({ cooler, tribeCrypto, tribesModel, padsModel }) => {
         }
         if (!isContentSane(c)) continue;
         const ts = v?.timestamp || Number(c?.timestamp || 0) || (c?.updatedAt ? Date.parse(c.updatedAt) : 0) || 0;
-        const normalized = c.type === 'contact' ? { ...c, contact: safeFeedId(c.contact) } : c;
-        idToAction.set(k, { id: k, author: v?.author, ts, type: inferType(c), content: normalized });
+        idToAction.set(k, { id: k, author: v?.author, ts, type: inferType(c), content: c });
         rawById.set(k, msg);
         if (c.replaces) parentOf.set(k, c.replaces);
       }

+ 1 - 1
src/server/package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "@krakenslab/oasis",
-  "version": "0.8.0",
+  "version": "0.8.1",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {

+ 1 - 1
src/server/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@krakenslab/oasis",
-  "version": "0.8.0",
+  "version": "0.8.1",
   "description": "Oasis - Social Networking Utopia",
   "repository": {
     "type": "git",

+ 1 - 29
src/views/activity_view.js

@@ -1011,32 +1011,6 @@ function renderActionCards(actions, userId, allActions, spreadMap = new Map()) {
       );
     }
 
-    if (type === 'contact') {
-      const { contact } = content || {};
-      const aId = action.author || '';
-      const bId = typeof contact === 'string'
-        ? contact
-        : (contact && typeof contact === 'object' && typeof contact.link === 'string' ? contact.link : '');
-      if (!bId) { skip = true; return null; }
-      const pa = getProfile(aId);
-      const pb = getProfile(bId);
-      const srcA = pa.image ? `/blob/${encodeURIComponent(pa.image)}` : '/assets/images/default-avatar.png';
-      const srcB = pb.image ? `/blob/${encodeURIComponent(pb.image)}` : '/assets/images/default-avatar.png';
-      cardBody.push(
-        div({ class: 'card-section contact' },
-          div({ class: 'activity-contact' },
-            a({ href: `/author/${encodeURIComponent(aId)}`, class: 'activity-contact-avatar-link' },
-              img({ src: srcA, alt: pa.name || pa.id, class: 'activity-contact-avatar' })
-            ),
-            span({ class: 'activity-contact-arrow' }, ''),
-            a({ href: `/author/${encodeURIComponent(bId)}`, class: 'activity-contact-avatar-link' },
-              img({ src: srcB, alt: pb.name || pb.id, class: 'activity-contact-avatar' })
-            )
-          )
-        )
-      );
-    }
-
     if (type === 'pub') {
       const { address } = content || {};
       const { key } = address || {};
@@ -1668,7 +1642,6 @@ function getViewDetailsAction(type, action) {
     case 'task':       return `/tasks/${id}`;
     case 'taskAssignment': return `/tasks/${encodeURIComponent(action.content?.taskId || action.tipId || action.id)}`;
     case 'about':      return `/author/${encodeURIComponent(action.author)}`;
-    case 'contact':    return `/inhabitants`;
     case 'pub':        return `/invites`;
     case 'market':     return `/market/${id}`;
     case 'shop':       return `/shops/${id}`;
@@ -1698,7 +1671,6 @@ exports.activityView = (actions, filter, userId, q = '', extras = {}) => {
     { type: 'mine',      label: i18n.mineButton },
     { type: 'report',    label: i18n.typeReport },
     { type: 'aiExchange',label: i18n.typeAiExchange },
-    { type: 'about',     label: i18n.typeAbout },
     { type: 'tribe',     label: i18n.typeTribe },
     { type: 'parliament',label: i18n.typeParliament },
     { type: 'courts',    label: i18n.typeCourts },
@@ -1728,7 +1700,7 @@ exports.activityView = (actions, filter, userId, q = '', extras = {}) => {
     { type: 'video',     label: i18n.typeVideo }
   ];
 
-  const EXCLUDED_TYPES = new Set(['spread', 'pixelia']);
+  const EXCLUDED_TYPES = new Set(['spread', 'pixelia', 'about', 'pub']);
   actions = actions.filter(action => !EXCLUDED_TYPES.has(action.type));
 
   let filteredActions;