From 04ae07d796259767fd81f6daebcd191204850790 Mon Sep 17 00:00:00 2001 From: nekobit Date: Wed, 8 Jun 2022 04:55:58 +0000 Subject: [PATCH] Only show pin status button on self statuses FossilOrigin-Name: 92b0521020f2d47d7b617d008117e27621fd8f8cbd3c1a0a7e8154fb690ab1c7 --- src/status.c | 10 +++++++--- static/status.tmpl | 7 +------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/status.c b/src/status.c index 4a7066a..fb94b2e 100644 --- a/src/status.c +++ b/src/status.c @@ -568,6 +568,7 @@ char* construct_status(struct session* ssn, char* notif_info = NULL; char* in_reply_to_str = NULL; char* delete_status = NULL; + char* pin_status = NULL; char* interactions_html = NULL; struct mstdnt_status* status = local_status; // Create a "fake" notification header which contains information for @@ -646,7 +647,7 @@ char* construct_status(struct session* ssn, free(repl_str); } - // Delete status menu item, logged in only + // Delete status menu item and pinned, logged in only if (ssn->logged_in && strcmp(status->account.acct, ssn->acct.acct) == 0) { struct menu_item_template mdata = { @@ -656,6 +657,10 @@ char* construct_status(struct session* ssn, .text = "Delete status" }; delete_status = tmpl_gen_menu_item(&mdata, NULL); + + mdata.itype = status->pinned ? "unpin" : "pin"; + mdata.text = status->pinned ? "Pin status" : "Unpin status"; + pin_status = tmpl_gen_menu_item(&mdata, NULL); } if (status->media_attachments_len) @@ -694,11 +699,10 @@ char* construct_status(struct session* ssn, .visibility = status->visibility, .unmute = status->muted ? "un" : "", .unmute_btn = status->muted ? "Unmute thread" : "Mute thread", - .unpin = status->pinned ? "un" : "", - .unpin_btn = status->pinned ? "Unpin" : "Pin", .unbookmark = status->bookmarked ? "un" : "", .unbookmark_btn = status->bookmarked ? "Remove Bookmark" : "Bookmark", .delete_status = delete_status, + .pin_status = pin_status, .in_reply_to_str = in_reply_to_str, .status_content = parse_content, .attachments = attachments, diff --git a/static/status.tmpl b/static/status.tmpl index 2285cff..7b32815 100644 --- a/static/status.tmpl +++ b/static/status.tmpl @@ -19,18 +19,13 @@ -
  • -
    - - -
    -
  • + {{%s:pin_status}} {{%s:delete_status}}