allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hei...@apache.org
Subject allura git commit: [#8026] remove FileChooser from discussion. Fixes [#4851] too by removing all forum icon logic, which wasn't being used anyway
Date Wed, 25 Nov 2015 19:15:21 GMT
Repository: allura
Updated Branches:
  refs/heads/master 5df150627 -> e7b50b500


[#8026] remove FileChooser from discussion.  Fixes [#4851] too by removing all forum icon
logic, which wasn't being used anyway


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/e7b50b50
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/e7b50b50
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/e7b50b50

Branch: refs/heads/master
Commit: e7b50b50082fd0e48706f7f36e66097be279b407
Parents: 5df1506
Author: Dave Brondsema <dave@brondsema.net>
Authored: Wed Nov 25 13:33:16 2015 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Wed Nov 25 13:33:16 2015 -0500

----------------------------------------------------------------------
 .../forgediscussion/controllers/forum.py        |  3 ---
 ForgeDiscussion/forgediscussion/forum_main.py   |  2 --
 .../forgediscussion/model/__init__.py           |  2 +-
 ForgeDiscussion/forgediscussion/model/forum.py  |  8 -------
 .../templates/discussion_widgets/add_forum.html |  2 --
 .../discussionforums/admin_forums.html          | 13 ------------
 .../tests/functional/test_forum_admin.py        | 22 --------------------
 ForgeDiscussion/forgediscussion/utils.py        | 11 ----------
 .../forgediscussion/widgets/admin.py            |  1 -
 9 files changed, 1 insertion(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/e7b50b50/ForgeDiscussion/forgediscussion/controllers/forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/forum.py b/ForgeDiscussion/forgediscussion/controllers/forum.py
index 8229151..ba1f366 100644
--- a/ForgeDiscussion/forgediscussion/controllers/forum.py
+++ b/ForgeDiscussion/forgediscussion/controllers/forum.py
@@ -117,9 +117,6 @@ class ForumController(DiscussionController):
             limit=limit,
             page=page)
 
-    @expose()
-    def icon(self):
-        return self.discussion.icon.serve()
 
     @expose('jinja:forgediscussion:templates/discussionforums/deleted.html')
     def deleted(self):

http://git-wip-us.apache.org/repos/asf/allura/blob/e7b50b50/ForgeDiscussion/forgediscussion/forum_main.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/forum_main.py b/ForgeDiscussion/forgediscussion/forum_main.py
index 96c2389..38f5fe3 100644
--- a/ForgeDiscussion/forgediscussion/forum_main.py
+++ b/ForgeDiscussion/forgediscussion/forum_main.py
@@ -310,8 +310,6 @@ class ForumAdminController(DefaultAdminController):
                     forum.acl = [M.ACE.allow(role_anon, 'post')]
                 else:
                     forum.acl = []
-                if 'icon' in f and f['icon'] is not None and f['icon'] != '':
-                    self.save_forum_icon(forum, f['icon'])
         flash('Forums updated')
         redirect(request.referrer)
 

http://git-wip-us.apache.org/repos/asf/allura/blob/e7b50b50/ForgeDiscussion/forgediscussion/model/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/model/__init__.py b/ForgeDiscussion/forgediscussion/model/__init__.py
index 182bd94..63a2171 100644
--- a/ForgeDiscussion/forgediscussion/model/__init__.py
+++ b/ForgeDiscussion/forgediscussion/model/__init__.py
@@ -15,4 +15,4 @@
 #       specific language governing permissions and limitations
 #       under the License.
 
-from forum import Forum, ForumFile, ForumThread, ForumPost, ForumAttachment
+from forum import Forum, ForumThread, ForumPost, ForumAttachment

http://git-wip-us.apache.org/repos/asf/allura/blob/e7b50b50/ForgeDiscussion/forgediscussion/model/forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/model/forum.py b/ForgeDiscussion/forgediscussion/model/forum.py
index 96e570d..675efa2 100644
--- a/ForgeDiscussion/forgediscussion/model/forum.py
+++ b/ForgeDiscussion/forgediscussion/model/forum.py
@@ -135,10 +135,6 @@ class Forum(M.Discussion):
     def discussion_thread(self):
         return None
 
-    @property
-    def icon(self):
-        return ForumFile.query.get(forum_id=self._id)
-
     def get_mail_footer(self, notification, toaddr):
         if toaddr and toaddr == self.monitoring_email:
             return MailFooter.monitored(
@@ -150,10 +146,6 @@ class Forum(M.Discussion):
         return super(Forum, self).get_mail_footer(notification, toaddr)
 
 
-class ForumFile(M.File):
-    forum_id = FieldProperty(schema.ObjectId)
-
-
 class ForumThread(M.Thread):
 
     class __mongometa__:

http://git-wip-us.apache.org/repos/asf/allura/blob/e7b50b50/ForgeDiscussion/forgediscussion/templates/discussion_widgets/add_forum.html
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/templates/discussion_widgets/add_forum.html b/ForgeDiscussion/forgediscussion/templates/discussion_widgets/add_forum.html
index f53d42d..2bbfab4 100644
--- a/ForgeDiscussion/forgediscussion/templates/discussion_widgets/add_forum.html
+++ b/ForgeDiscussion/forgediscussion/templates/discussion_widgets/add_forum.html
@@ -36,8 +36,6 @@
     <div class="grid-14"><textarea name="add_forum.description" style="height:50px;">{{value['description']}}</textarea></div>
     <label class="grid-5">Monitoring Email:</label>
     <div class="grid-14"><input type="text" name="add_forum.monitoring_email" value="{{value['monitoring_email']}}"></div>
-    <label class="grid-5">Icon:</label>
-    <div class="grid-14">{{lib.file_field('add_forum.icon', '')}}</div>
     <label class="grid-5">Developer Only:</label>
     <div class="grid-14"><input name="add_forum.members_only" type="checkbox"{%
if value['members_only'] %} checked{% endif %}></div>
     <label class="grid-5">Allow anonymous posts:</label>

http://git-wip-us.apache.org/repos/asf/allura/blob/e7b50b50/ForgeDiscussion/forgediscussion/templates/discussionforums/admin_forums.html
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/templates/discussionforums/admin_forums.html
b/ForgeDiscussion/forgediscussion/templates/discussionforums/admin_forums.html
index 4d31933..aaa06cd 100644
--- a/ForgeDiscussion/forgediscussion/templates/discussionforums/admin_forums.html
+++ b/ForgeDiscussion/forgediscussion/templates/discussionforums/admin_forums.html
@@ -28,7 +28,6 @@
   <table id="forums">
     <thead>
       <tr>
-        <th></th>
         <th>Forum</th><th>Topics</th><th>Posts</th><th>Last
Post</th>
         <th></th>
       </tr>
@@ -38,18 +37,6 @@
       <tr class="{{loop.index0%2 and ' even' or ''}}">
         <td>
           <div class="editable viewing">
-            <span class="viewer">
-              {% if forum.icon %}
-                <img src="{{forum.url()}}icon" alt="Forum icon"/>
-              {% else %}
-                <img src="{{g.forge_static('images/project_default.png')}}" alt="Forum
icon"/>
-              {% endif %}
-            </span>
-            <span class="editor">{{lib.file_field('forum-%s.icon' % loop.index0, '')}}</span>
-          </div>
-        </td>
-        <td>
-          <div class="editable viewing">
             <span class="viewer"><a href="{{forum.url()}}">{{h.really_unicode(forum.name)}}</a></span>
             <span class="editor">
               {{lib.text_field('forum-%s.name' % loop.index0, 'Forum Title', h.really_unicode(forum.name))}}

http://git-wip-us.apache.org/repos/asf/allura/blob/e7b50b50/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py b/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
index 3e7f0d4..983a8be 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
@@ -119,28 +119,6 @@ class TestForumAdmin(TestController):
         r = r.forms[3].submit()
         assert 'error' in r
 
-    def test_forum_icon(self):
-        file_name = 'neo-icon-set-454545-256x350.png'
-        file_path = os.path.join(
-            allura.__path__[0], 'nf', 'allura', 'images', file_name)
-        file_data = file(file_path).read()
-        upload = ('add_forum.icon', file_name, file_data)
-
-        h.set_context('test', 'discussion', neighborhood='Projects')
-        r = self.app.get('/admin/discussion/forums')
-        app_id = r.forms[3]['add_forum.app_id'].value
-        r = self.app.post('/admin/discussion/add_forum',
-                          params={'add_forum.shortname': 'testforum',
-                                  'add_forum.app_id': app_id,
-                                  'add_forum.name': 'Test Forum',
-                                  'add_forum.description': '',
-                                  'add_forum.parent': '',
-                                  },
-                          upload_files=[upload]),
-        r = self.app.get('/discussion/testforum/icon')
-        image = PIL.Image.open(StringIO(r.body))
-        assert image.size == (48, 48)
-
     def test_delete_undelete(self):
         r = self.app.get('/admin/discussion/forums')
         r = self.app.get('/admin/discussion/forums')

http://git-wip-us.apache.org/repos/asf/allura/blob/e7b50b50/ForgeDiscussion/forgediscussion/utils.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/utils.py b/ForgeDiscussion/forgediscussion/utils.py
index d9128d9..1169caf 100644
--- a/ForgeDiscussion/forgediscussion/utils.py
+++ b/ForgeDiscussion/forgediscussion/utils.py
@@ -24,15 +24,6 @@ from allura.model import ProjectRole, ACE, ALL_PERMISSIONS, DENY_ALL
 from forgediscussion import model as DM
 
 
-def save_forum_icon(forum, icon):
-    if forum.icon:
-        forum.icon.delete()
-    DM.ForumFile.save_image(
-        icon.filename, icon.file, content_type=icon.type,
-        square=True, thumbnail_size=(48, 48),
-        thumbnail_meta=dict(forum_id=forum._id))
-
-
 def create_forum(app, new_forum):
     if 'parent' in new_forum and new_forum['parent']:
         parent_id = ObjectId(str(new_forum['parent']))
@@ -66,6 +57,4 @@ def create_forum(app, new_forum):
         f.acl = [ACE.allow(role_anon, 'post')]
     else:
         f.acl = []
-    if 'icon' in new_forum and new_forum['icon'] is not None and new_forum['icon'] != '':
-        save_forum_icon(f, new_forum['icon'])
     return f

http://git-wip-us.apache.org/repos/asf/allura/blob/e7b50b50/ForgeDiscussion/forgediscussion/widgets/admin.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/widgets/admin.py b/ForgeDiscussion/forgediscussion/widgets/admin.py
index 696f155..7de847e 100644
--- a/ForgeDiscussion/forgediscussion/widgets/admin.py
+++ b/ForgeDiscussion/forgediscussion/widgets/admin.py
@@ -76,7 +76,6 @@ class AddForum(ff.AdminForm):
                          validator=fev.UnicodeString()),
             ew.TextField(name='monitoring_email',
                          label='Monitoring Email', validator=fev.Email()),
-            ffw.FileChooser(name='icon', label='Icon'),
             ew.Checkbox(name="members_only", label="Developer Only"),
             ew.Checkbox(name="anon_posts", label="Allow Anonymous Posts")
         ]


Mime
View raw message