|
849 | 849 |
|
850 | 850 | (defmethod post-control-event! :load-first-green-build-github-users
|
851 | 851 | [target message {:keys [vcs-type project-name]} previous-state current-state]
|
852 |
| - (ajax/ajax :get |
853 |
| - (api-path/project-users vcs-type project-name) |
854 |
| - :first-green-build-github-users |
855 |
| - (get-in current-state [:comms :api]) |
856 |
| - :context {:project-name project-name})) |
| 852 | + (if (or (nil? vcs-type) (= "github" vcs-type)) |
| 853 | + (ajax/ajax :get |
| 854 | + (api-path/project-users vcs-type project-name) |
| 855 | + :first-green-build-github-users |
| 856 | + (get-in current-state [:comms :api]) |
| 857 | + :context {:project-name project-name}))) |
857 | 858 |
|
858 | 859 | (defmethod post-control-event! :invited-github-users
|
859 | 860 | [target message {:keys [vcs-type project-name org-name invitees]} previous-state current-state]
|
860 |
| - (let [org-vcs-type "github" |
861 |
| - context (if project-name |
862 |
| - ;; TODO: non-hackish way to indicate the type of invite |
863 |
| - {:project project-name :first_green_build true} |
864 |
| - {:org org-name})] |
865 |
| - (button-ajax :post |
866 |
| - (if project-name |
867 |
| - (api-path/project-users-invite vcs-type project-name) |
868 |
| - (api-path/organization-invite org-vcs-type org-name)) |
869 |
| - :invite-github-users |
870 |
| - (get-in current-state [:comms :api]) |
871 |
| - :context context |
872 |
| - :params invitees |
873 |
| - :events {:success #(analytics/track {:event-type :teammates-invited |
874 |
| - :current-state current-state |
875 |
| - :properties {:vcs-type :github |
876 |
| - :invitees invitees |
877 |
| - :invitee-count (count invitees)}})}))) |
| 861 | + (if (or (nil? vcs-type) (= "github" vcs-type)) |
| 862 | + (let [project-vcs-type (or vcs-type "github") |
| 863 | + org-vcs-type "github" |
| 864 | + context (if project-name |
| 865 | + ;; TODO: non-hackish way to indicate the type of invite |
| 866 | + {:project project-name :first_green_build true} |
| 867 | + {:org org-name})] |
| 868 | + (button-ajax :post |
| 869 | + (if project-name |
| 870 | + (api-path/project-users-invite project-vcs-type project-name) |
| 871 | + (api-path/organization-invite org-vcs-type org-name)) |
| 872 | + :invite-github-users |
| 873 | + (get-in current-state [:comms :api]) |
| 874 | + :context context |
| 875 | + :params invitees |
| 876 | + :events {:success #(analytics/track {:event-type :teammates-invited |
| 877 | + :current-state current-state |
| 878 | + :properties {:vcs-type :github |
| 879 | + :invitees invitees |
| 880 | + :invitee-count (count invitees)}})})))) |
878 | 881 |
|
879 | 882 | (defmethod post-control-event! :report-build-clicked
|
880 | 883 | [target message {:keys [build-url]} previous-state current-state]
|
|
0 commit comments