Browse Source

fixed invites exception

psy 1 year ago
parent
commit
b8ba5e902f
3 changed files with 24 additions and 18 deletions
  1. 8 4
      src/index.js
  2. 4 2
      src/views/i18n.js
  3. 12 12
      src/views/index.js

+ 8 - 4
src/index.js

@@ -387,7 +387,7 @@ const {
   topicsView,
   summaryView,
   threadsView,
-  clonedView,
+  spreadedView,
 } = require("./views");
 
 let sharp;
@@ -486,7 +486,6 @@ router
   })
   .get("/author/:feed", async (ctx) => {
     const { feed } = ctx.params;
-
     const gt = Number(ctx.request.query["gt"] || -1);
     const lt = Number(ctx.request.query["lt"] || -1);
 
@@ -1048,8 +1047,13 @@ router
     ctx.redirect("/peers");
   })
   .post("/settings/invite/accept", koaBody(), async (ctx) => {
-    const invite = String(ctx.request.body.invite);
-    await meta.acceptInvite(invite);
+    try {
+      const invite = String(ctx.request.body.invite);
+      await meta.acceptInvite(invite);
+      } catch (e) {
+          // Just in case it's an invalid invite code. :(
+          debug(e);
+      }
     ctx.redirect("/invites");
   })
   .post("/settings/rebuild", async (ctx) => {

+ 4 - 2
src/views/i18n.js

@@ -38,6 +38,7 @@ const i18n = {
       " from inhabitants you support and your extended network, sorted by recency. Select the timestamp of any post to see the rest of the thread.",
     ],
     profile: "Avatar",
+    inhabitants: "Inhabitants", 
     manualMode: "Manual Mode",
     mentions: "Mentions",
     mentionsDescription: [
@@ -81,7 +82,7 @@ const i18n = {
     relationshipBlockingPost: "Blocked post",
     // spreads view
     viewLikes: "View spreads",
-    clonedDescription: "List of posts spread by the inhabitant.",
+    spreadedDescription: "List of posts spread by the inhabitant.",
     likedBy: " -> Spreads",
     // composer
     attachFiles: "Attach files",
@@ -199,6 +200,7 @@ const i18n = {
   es: {
     latest: "Novedades",
     profile: "Avatar",
+    inhabitants: "Habitantes",
     search: "Buscar",
     imageSearch: "Buscar Imágenes",
     settings: "Configuración",
@@ -277,7 +279,7 @@ const i18n = {
     noNewerPosts: "No se han recibido nuevos posts aún.",
     // spreads view
     viewLikes: "Ver difusiones",
-    clonedDescription: "Listado de posts difundidos del habitante.",
+    spreadedDescription: "Listado de posts difundidos del habitante.",
     likedBy: " -> Difusiones",
     // composer
     attachFiles: "Agregar archivos",

+ 12 - 12
src/views/index.js

@@ -127,22 +127,22 @@ const template = (titlePrefix, ...elements) => {
     body(
       nav(
         ul(
-          navLink({ href: "/search", emoji: "✦", text: i18n.search }),
           //navLink({ href: "/imageSearch", emoji: "✧", text: i18n.imageSearch }),
-          navLink({ href: "/public/popular/day", emoji: "⌘", text: i18n.popular }),
           navLink({ href: "/public/latest/extended", emoji: "∞", text: i18n.extended }),
+          navLink({ href: "/public/popular/day", emoji: "⌘", text: i18n.popular }),
           navLink({ href: "/public/latest/threads", emoji: "♺", text: i18n.threads }),
           navLink({ href: "/public/latest", emoji: "☄", text: i18n.latest }),
           navLink({ href: "/public/latest/topics", emoji: "ϟ", text: i18n.topics }),
           navLink({ href: "/public/latest/summaries", emoji: "※", text: i18n.summaries }),
+          navLink({ href: "/mentions", emoji: "✺", text: i18n.mentions }),
         )
       ),
       main({ id: "content" }, elements),
       nav(
         ul(
-          navLink({ href: "/publish", emoji: "✍",text: i18n.publish }),
+          navLink({ href: "/publish", emoji: "❂",text: i18n.publish }),
+          navLink({ href: "/search", emoji: "✦", text: i18n.search }),
           navLink({ href: "/inbox", emoji: "☂", text: i18n.private }),
-          navLink({ href: "/mentions", emoji: "☏", text: i18n.mentions }),
           navLink({ href: "/profile", emoji: "⚉", text: i18n.profile }),
           navLink({ href: "/invites", emoji: "❄", text: i18n.invites }),
           navLink({ href: "/peers", emoji: "⧖", text: i18n.peers }),
@@ -930,15 +930,15 @@ const generatePreview = ({ previewData, contentWarning, action }) => {
                 let relationship = { emoji: "", desc: "" };
                 if (m.rel.followsMe && m.rel.following) {
                   // mutuals get the handshake emoji
-                  relationship.emoji = "🤝";
+                  relationship.emoji = "";
                   relationship.desc = i18n.relationshipMutuals;
                 } else if (m.rel.following) {
                   // if we're following that's an eyes emoji
-                  relationship.emoji = "👀";
+                  relationship.emoji = "";
                   relationship.desc = i18n.relationshipFollowing;
                 } else if (m.rel.followsMe) {
                   // follower has waving-hand emoji
-                  relationship.emoji = "👋";
+                  relationship.emoji = "";
                   relationship.desc = i18n.relationshipTheyFollow;
                 } else {
                   // no relationship has question mark emoji
@@ -1181,7 +1181,7 @@ exports.likesView = async ({ messages, feed, name }) => {
     ["@", name, i18n.likedBy],
     viewInfoBox({
       viewTitle: span(authorLink, i18n.likedBy),
-      viewDescription: span(i18n.clonedDescription)
+      viewDescription: span(i18n.spreadedDescription)
     }),
     messages.map((msg) => post({ msg }))
   );
@@ -1245,11 +1245,11 @@ exports.summaryView = ({ messages }) => {
   });
 };
 
-exports.clonedView = ({ messages }) => {
-  return clonedListView({
+exports.spreadedView = ({ messages }) => {
+  return spreadedListView({
     messages,
-    viewTitle: i18n.cloned,
-    viewDescription: i18n.clonedDescription,
+    viewTitle: i18n.spreaded,
+    viewDescription: i18n.spreadedDescription,
   });
 };