Skip to content

Commit

Permalink
WIP: member editing
Browse files Browse the repository at this point in the history
  • Loading branch information
akihikodaki committed Jan 7, 2017
1 parent cac67ee commit b007242
Show file tree
Hide file tree
Showing 10 changed files with 496 additions and 146 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ Either of the following browsers:
* Microsoft Edge
* Microsoft Internet Explorer 11
* Mozilla Firefox 45 or any later version

# Standards
This application implicitly conforms to the following standards.

* [Accessible Rich Internet Applications (WAI-ARIA) 1.0](https://www.w3.org/TR/2014/REC-wai-aria-20140320/)
* [DOM Standard](https://dom.spec.whatwg.org/)
* [Encoding Standard](Encoding Standard)
* [HTML Standard](https://html.spec.whatwg.org/)
* [URL Standard](https://url.spec.whatwg.org/)
* [XMLHttpRequest Standard](https://xhr.spec.whatwg.org/)
2 changes: 1 addition & 1 deletion unchunked/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func parseCodings(field string, begin int) (codingIndex, int) {

coding := strings.ToUpper(field[begin:end])
index := codingIndex(sort.SearchStrings(codings, coding))
if codings[index] != coding {
if index < codingIndex(len(codings)) && codings[index] != coding {
index = codingUnknown
}

Expand Down
2 changes: 1 addition & 1 deletion unchunked/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestParseCodings(t *testing.T) {
*/
{`*`, codingAny},

{`DEFLATE`, codingUnknown},
{`DEFLATE`, codingUnknown}, {`~`, codingUnknown},
} {
coding := coding

Expand Down
4 changes: 4 additions & 0 deletions webapp/src/private/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export function clubListName() {
return session.applyToken(token => api.clubListName(token));
}

export function getID() {
return session.getID();
}

/**
memberDetail returns the details of the member identified with the given
ID.
Expand Down
22 changes: 14 additions & 8 deletions webapp/src/private/client/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ const state = new WeakMap();
export default class {
/** constructor constructs a new instance. */
constructor() {
state.set(this, new class {
constructor() {
this.accessToken = null;
this.refreshToken = null;
}
state.set(this, {
storeID() {
sessionStorage.setItem("id", this.id);
},

storeRefreshToken() {
sessionStorage.setItem("refresh_token",
this.refreshToken);
}
sessionStorage.setItem("refresh_token", this.refreshToken);
},
});

Object.freeze(this);
Expand Down Expand Up @@ -65,6 +63,10 @@ export default class {
});
}

getID() {
return state.get(this).id;
}

/**
recover recovers session from sessionStorage.
@returns {!external:jQuery.$.Deferred#promise} A promise
Expand All @@ -77,6 +79,7 @@ export default class {
const local = state.get(this);

local.accessToken = data.access_token;
local.id = sessionStorage.getItem("id");
if (data.refresh_token) {
local.refreshToken = data.refresh_token;
local.storeRefreshToken();
Expand All @@ -96,7 +99,10 @@ export default class {
const local = state.get(this);

local.accessToken = data.access_token;
local.id = id;
local.refreshToken = data.refresh_token;

local.storeID();
local.storeRefreshToken();
});
}
Expand Down
Loading

0 comments on commit b007242

Please sign in to comment.