Skip to content

Commit fe57453

Browse files
committed
Revert "Merge pull request BlitzKraft#258 from tushar5526/search"
This reverts commit 0a0ad8a, reversing changes made to 5671a08.
1 parent a72259d commit fe57453

File tree

3 files changed

+7
-30
lines changed

3 files changed

+7
-30
lines changed

saythanks/core.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ def index():
9898
auth_domain=auth_domain)
9999

100100

101-
@app.route('/inbox', methods=['POST', 'GET'])
101+
@app.route('/inbox')
102102
@requires_auth
103103
def inbox():
104+
104105
# Auth0 stored account information.
105106
profile = session['profile']
106107

@@ -109,17 +110,11 @@ def inbox():
109110
is_enabled = storage.Inbox.is_enabled(inbox_db.slug)
110111

111112
is_email_enabled = storage.Inbox.is_email_enabled(inbox_db.slug)
112-
if request.method == "GET":
113-
# Send over the list of all given notes for the user.
114-
return render_template('inbox.htm.j2',
115-
user=profile, notes=inbox_db.notes,
116-
inbox=inbox_db, is_enabled=is_enabled,
117-
is_email_enabled=is_email_enabled)
118-
search_str = request.form['search_str']
113+
# Send over the list of all given notes for the user.
119114
return render_template('inbox.htm.j2',
120-
user=profile, notes=inbox_db.search_notes(search_str),
121-
is_email_enabled=is_email_enabled)
122-
115+
user=profile, notes=inbox_db.notes,
116+
inbox=inbox_db, is_enabled=is_enabled,
117+
is_email_enabled=is_email_enabled)
123118

124119

125120
@app.route('/inbox/export/<format>')
@@ -351,4 +346,3 @@ def callback_handling():
351346
# Using nickname by default, can be changed manually later if needed.
352347
storage.Inbox.store(nickname, userid, email)
353348
return redirect(url_for('inbox'))
354-

saythanks/storage.py

-14
Original file line numberDiff line numberDiff line change
@@ -208,20 +208,6 @@ def notes(self):
208208
for n in r
209209
]
210210
return notes[::-1]
211-
212-
def search_notes(self, search_str):
213-
"""Returns a list of notes, queried by search string "param" """
214-
q = sqlalchemy.text("""SELECT * from notes where ( body LIKE '%' || :param || '%' or byline LIKE '%' || :param || '%' ) and inboxes_auth_id = :auth_id""")
215-
r = conn.execute(q, param=search_str, auth_id=self.auth_id).fetchall()
216-
217-
notes = [
218-
Note.from_inbox(
219-
self.slug,
220-
n["body"], n["byline"], n["archived"], n["uuid"], n["timestamp"]
221-
)
222-
for n in r
223-
]
224-
return notes[::-1]
225211

226212
def export(self, file_format):
227213
q = sqlalchemy.text("SELECT * from notes where inboxes_auth_id = :auth_id and archived = 'f'")

saythanks/templates/inbox.htm.j2

+1-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@
7272
<h3>Notes of Thankfulness:</h3>
7373
</p>
7474

75-
<form action="/inbox" method="POST">
76-
<input type="text" style="font-size:14px" size=28 placeholder="Search by message body or byline" name="search_str">
77-
<button style="font-size:10px" type="submit">Search</button>
78-
</form>
75+
7976
<table>
8077
<thead>
8178
<tr>

0 commit comments

Comments
 (0)