branch: elpa/fj
commit 16d4dfc586245dd4b726b129591e08ed50d14bce
Merge: 48a299cb54 f11cf25a2e
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>

    Merge branch 'dev'
---
 fj-transient.el | 17 +++++++++++------
 fj.el           | 14 +++++---------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/fj-transient.el b/fj-transient.el
index 96d1d02824..dbd988c0b3 100644
--- a/fj-transient.el
+++ b/fj-transient.el
@@ -257,13 +257,18 @@ Provide current topics for adding/removing."
    ("C-c C-c" "Save settings" fj-update-repo)
    ("C-x C-k" :info "to revert all changes")]
   (interactive)
-  ;; FIXME: bail if we are not authorized to change this repo!
-  (if fj-current-repo
+  (if (not fj-current-repo)
+      (if (y-or-n-p "No repo. Try to use git config?")
+          (setq fj-current-repo (cadr (fj-repo-+-owner-from-git)))
+        (user-error "No repo")))
+  (if-let* ((data (fj-get-repo fj-current-repo
+                               (fj--repo-owner)))
+            ;; bail if we are not authorized to change this repo
+            ;; FIXME: how to confirm if admin required to change repo settings:
+            (perm (alist-get 'permissions data))
+            (admin-p (eq t (alist-get 'admin perm))))
       (transient-setup 'fj-repo-update-settings)
-    (if (y-or-n-p "No repo. Try to use git config?")
-        (if-let* ((repo-+-owner (fj-repo-+-owner-from-git))
-                  (fj-current-repo (cadr repo-+-owner)))
-            (transient-setup 'fj-repo-update-settings)))))
+    (user-error "You don't have permission to modify this repo")))
 
 (transient-define-suffix fj-update-user-settings (&optional args)
   "Update current user settings on the server."
diff --git a/fj.el b/fj.el
index b6cb98484c..98dc16c4f2 100644
--- a/fj.el
+++ b/fj.el
@@ -3,15 +3,10 @@
 ;; Author: Marty Hiatt <[email protected]>
 ;; Copyright (C) 2023 Marty Hiatt <[email protected]>
 ;;
-;; Package-Requires:
-;; ((emacs "29.1")
-;;  (fedi "0.2")
-;;  (tp "0.8")
-;;  (transient "0.10.0")
-;;  (magit "4.3.8"))
+;; Package-Requires: ((emacs "29.1") (fedi "0.2") (tp "0.8") (transient 
"0.10.0") (magit "4.3.8"))
 ;; Keywords: git, convenience
 ;; URL: https://codeberg.org/martianh/fj.el
-;; Version: 0.29
+;; Version: 0.30
 ;; Separator: -
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -37,8 +32,8 @@
 ;; (issue, PR) timelines, as well as for composing items and comments. It
 ;; is built with fedi.el, which in turn is based on mastodon.el.
 
-;; To get started, first set `fj-token' and `fj-user'. Then either set
-;; your Forgejo access token in your auth-source file or set `fj-host' to
+;; To get started, first set `fj-host' and `fj-user'. Then either set
+;; your Forgejo access token in your auth-source file or set `fj-token' to
 ;; it.
 
 ;; For further details, see the readme at
@@ -2291,6 +2286,7 @@ If we are not in a repo, call `fj-list-issues-do' without 
using
 git config."
   (if (or current-prefix-arg ;; still allow completing-read a repo
           ;; NB: this is T in fj buffers when no source files:
+          ;; NB: this is nil in magit's commit message buffer:
           (not (magit-inside-worktree-p :noerror)))
       ;; fall back to `fj--repo-owner' repos:
       (fj-list-issues-do repo owner state type)

Reply via email to