Skip to content

Commit 2f78cca

Browse files
committed
Remove broken functions.
- api.get.loggedin_accounts() no longer works. - this also breaks api.get.delegated_to_email() - this also breaks api.get.manager_email() - removing those also mean we no longer need api.helper.get.is_delegated_inbox() either. Bye bye :)
1 parent 4eb0f92 commit 2f78cca

File tree

3 files changed

+0
-109
lines changed

3 files changed

+0
-109
lines changed

README.md

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ import "gmail-js";
8585

8686

8787
- [gmail.get**.user_email()**](#gmailgetuser_email)
88-
- [gmail.get**.manager_email()**](#gmailgetmanager_email)
8988
- [gmail.get**.current_page()**](#gmailgetcurrent_page)
9089

9190
- [gmail.get**.new.email_id()**](#gmailnewgetemail_id)
@@ -108,7 +107,6 @@ import "gmail-js";
108107
- [gmail.get**.unread_social_emails()**](#gmailgetunread_emails)
109108
- [gmail.get**.last_active()**](#gmailgetlast_active)
110109
- [gmail.get**.storage_info()**](#gmailgetstorage_info)
111-
- [gmail.get**.loggedin_accounts()**](#gmailgetloggedin_accounts)
112110
- [gmail.get**.beta()**](#gmailgetbeta)
113111
- [gmail.get**.localization()**](#gmailgetlocalization)
114112

@@ -466,22 +464,6 @@ Returns the current user's email address
466464
467465
```
468466

469-
#### gmail.get.manager_email()
470-
471-
Returns the email address of the user currently managing the account (if the inbox is used by the owner, this function returns the same value as [gmail.get**.user_email()**](#gmailgetuser_email))
472-
473-
```js
474-
475-
```
476-
477-
#### gmail.get.delegated_to_email()
478-
479-
Returns the email address of the user the account is currently delegated to (if the inbox is used by the owner, this function returns null)
480-
481-
```js
482-
483-
```
484-
485467
#### gmail.get.storage_info()
486468

487469
Returns current user's file storage stats
@@ -573,14 +555,6 @@ Gets user's account activity data
573555
}
574556
```
575557

576-
#### gmail.get.loggedin_accounts()
577-
578-
Returns a list of signed-in accounts (multiple user accounts setup in gmail)
579-
580-
```json
581-
[{"name":"California","email":"[email protected]"}]
582-
```
583-
584558
#### gmail.get.beta()
585559

586560
Although hand picked, this method returns the checks on beta features and deployments

src/gmail.d.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,28 +124,10 @@ interface GmailGet {
124124
*/
125125
last_active(): GmailLastActive;
126126

127-
/**
128-
Returns a list of signed-in accounts (multiple user accounts
129-
setup in gmail)
130-
*/
131-
loggedin_accounts(): GmailLoggedInAccount[];
132-
133127
/**
134128
Returns the current user's email address
135129
*/
136130
user_email(): string;
137-
/**
138-
Returns the email address of the user currently managing the
139-
account (if the inbox is used by the owner, this function
140-
returns the same value as gmail.get.user_email())
141-
*/
142-
manager_email(): string;
143-
/**
144-
Returns the email address of the user the account is currently
145-
delegated to (if the inbox is used by the owner, this function
146-
returns null)
147-
*/
148-
delegated_to_email(): string;
149131
/**
150132
Returns the Gmail localization, e.g. 'US'.
151133
*/

src/gmail.js

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -96,71 +96,11 @@ var Gmail = function(localJQuery) {
9696
};
9797

9898

99-
api.get.loggedin_accounts = function() {
100-
var i, j, data;
101-
var users = [];
102-
103-
var globals17 = api.tracker.globals[17];
104-
for (i in globals17) {
105-
// at least for the delegated inboxes, the index of the mla is not stable
106-
// it was observed to be somewhere between 22 and 24, but we should not depend on it
107-
data = globals17[i];
108-
109-
if (data[0] === "mla") {
110-
for(j in data[1]) {
111-
users.push({
112-
name : data[1][j][4],
113-
email : data[1][j][0],
114-
index: data[1][j][3]
115-
});
116-
}
117-
118-
return users;
119-
}
120-
}
121-
122-
return users;
123-
};
124-
125-
12699
api.get.user_email = function() {
127100
return api.tracker.globals[10];
128101
};
129102

130103

131-
api.get.manager_email = function() {
132-
if (api.helper.get.is_delegated_inbox()) {
133-
return api.get.delegated_to_email();
134-
}
135-
136-
return api.get.user_email();
137-
};
138-
139-
140-
api.get.delegated_to_email = function() {
141-
if (!api.helper.get.is_delegated_inbox()) {
142-
return null;
143-
}
144-
145-
var i, account;
146-
var userIndexPrefix = "/u/";
147-
var pathname = window.location.pathname;
148-
var delegatedToUserIndex = parseInt(pathname.substring(pathname.indexOf(userIndexPrefix) + userIndexPrefix.length), 10);
149-
150-
var loggedInAccounts = api.get.loggedin_accounts();
151-
if (loggedInAccounts && loggedInAccounts.length > 0) {
152-
for (i in loggedInAccounts) {
153-
account = loggedInAccounts[i];
154-
if (account.index === delegatedToUserIndex) {
155-
return account.email;
156-
}
157-
}
158-
}
159-
160-
// as a last resort, we query the DOM of the upper right account selection menu
161-
return $(".gb_rb[href$='" + userIndexPrefix + delegatedToUserIndex + "'] .gb_yb").text().split(" ")[0];
162-
};
163-
164104
api.helper.get.is_locale = function(locale) {
165105
// A locale is a string that begins with 2 letters, either lowercase or uppercase
166106
// The "lowercase" check distinguishes locales from other 2-letter strings like "US"
@@ -2816,11 +2756,6 @@ var Gmail = function(localJQuery) {
28162756
};
28172757

28182758

2819-
api.helper.get.is_delegated_inbox = function() {
2820-
return $(".identityUserDelegatedAccount").length === 1;
2821-
};
2822-
2823-
28242759
api.helper.get.visible_emails_pre = function(customInboxQuery) {
28252760
var page = api.get.current_page();
28262761
var url = window.location.origin + window.location.pathname + "?ui=2&ik=" + api.tracker.ik+"&rid=" + api.tracker.rid + "&view=tl&num=120&rt=1";

0 commit comments

Comments
 (0)