Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sx networks #69

Merged
merged 10 commits into from
Nov 18, 2014
Merged

Sx networks #69

merged 10 commits into from
Nov 18, 2014

Conversation

jleechpe
Copy link
Collaborator

Provide functionality for retrieving network information as well as keeping track of favorite questions.

sx-network--user-information: User query from site.
sx-network--user-sites: List of sites user is active on for use when
querying sites.
(sx-network--ensure-user): Ensures network-user cache is available for
use.
(sx-network--update): Retrieve most recent network user information.
sx-favorites--ensure-favorite-list: List of favorites in format (SITE
QUESTION_ID QUESTION_ID ...).
(sx-favorites--update-site-favorites): Update favorites for given SITE.
(sx-favorites-update): Update favorites for all networks user has an
account on.
(let ((u-site (cdr (assoc 'site_url loc))))
(when (member u-site (mapcar 'car sites-info))
(cdr (assoc u-site sites-info)))))
(sx-network--user-information))))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a variable?

- sx-network--user-information is a var not a function
- remember to setq sx-network--user-sites.
sx-favorites--user-favorite-list)))
(if site-cell
(setcdr site-cell (mapcar 'cdar favs))
(push (list site favs) sx-favorites--user-favorite-list))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be (cons site favs)?

@vermiculus vermiculus added this to the v0.2 milestone Nov 18, 2014

(defun sx-favorites--retrieve-favorites (site)
"Obtain list of starred QUESTION_IDs for SITE."
(sx-method-call (format "me/favorites?site=%s" site)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

site is a keyword argument, it should be supplied as such.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is the Kludge I mentioned in gitter. If I pass site as a keyword argument, then meta+main sites will return the same favorite list due to back-to-back retrievals (need to delay ~2 minutes). Passing it this way provides the correct favorite lists.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really doesn't make any sense – have you taken all debugging steps, etc.? If so, we can leave it this way for the PR and open a hi-pri issue to figure out what in heaven's name is going on…

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproducible (users/337/* is my account, so using it rather than me/* to provide you the same results.)

(cl-prettyprint
 (cl-loop for test-site in '(emacs meta.emacs) collect
          (cons test-site
                (sx-method-call
                 "users/337/favorites"
                 `((site . ,test-site))
                 sx-favorite-list-filter
                 'nil))))
((emacs . [((question_id . 3356)) ((question_id . 2497))])
 (meta\.emacs . [((question_id . 3356)) ((question_id . 2497))]))


(cl-prettyprint
 (cl-loop for test-site in '(emacs meta.emacs) collect
          (cons test-site
                (sx-method-call
                 (format "users/337/favorites?site=%s" test-site)
                 nil
                 sx-favorite-list-filter
                 'warn))))
((emacs . [((question_id . 3356)) ((question_id . 2497))])
 (meta\.emacs . [((question_id . 218))]))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If all's working. I agree with merging this and opening a separate issue to look into the problem.
Seems like a complicated matter and there's a lot in this PR already.

sx-cache-set.

Fix provides lines (missed quote on symbol).
(sx-network--get-associated): Ensure user-sites is also set when
retrieving cache.
(sx-network--ensure-user): Simplify.  Used to ensure cache is loaded
before attempting to use it.

Fix quoted lambda in sx-network--map-site-url-to-site-api.
sx-favorites--user-favorite-list: Clarify docstring
(sx-favorites--ensure-favorite-list): Remove extraneous argument
@@ -0,0 +1,88 @@
;;; sx-site.el --- browsing sites -*- lexical-binding: t; -*-
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops; also here. :(

Correct file header.
Use sharp quote for function.
Use sharp quote for function.
@vermiculus
Copy link
Owner

Looks good.

vermiculus added a commit that referenced this pull request Nov 18, 2014
Functionality for retrieving network information and keeping track of favorite questions.
@vermiculus vermiculus merged commit c0a4f01 into vermiculus:master Nov 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants